character-encoding-utils 0.0.5__tar.gz → 0.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- character_encoding_utils-0.0.7/.github/workflows/publish.yml +29 -0
- character_encoding_utils-0.0.7/.github/workflows/test.yml +24 -0
- character_encoding_utils-0.0.7/.gitignore +141 -0
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/PKG-INFO +9 -9
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/README.md +1 -1
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/pyproject.toml +8 -3
- character_encoding_utils-0.0.7/requirements.txt +1 -0
- character-encoding-utils-0.0.5/setup.cfg +0 -4
- character-encoding-utils-0.0.5/src/character_encoding_utils.egg-info/PKG-INFO +0 -79
- character-encoding-utils-0.0.5/src/character_encoding_utils.egg-info/SOURCES.txt +0 -16
- character-encoding-utils-0.0.5/src/character_encoding_utils.egg-info/dependency_links.txt +0 -1
- character-encoding-utils-0.0.5/src/character_encoding_utils.egg-info/top_level.txt +0 -1
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/LICENSE +0 -0
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/src/character_encoding_utils/__init__.py +0 -0
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/src/character_encoding_utils/big5.py +4 -4
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/src/character_encoding_utils/gb2312.py +4 -4
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/src/character_encoding_utils/ksx1001.py +4 -4
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/src/character_encoding_utils/shiftjis.py +4 -4
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/tests/test_big5.py +0 -0
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/tests/test_gb2312.py +0 -0
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/tests/test_ksx1001.py +0 -0
- {character-encoding-utils-0.0.5 → character_encoding_utils-0.0.7}/tests/test_shiftjis.py +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment:
|
|
11
|
+
name: pypi
|
|
12
|
+
url: https://pypi.org/project/character-encoding-utils/
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
- name: Setup Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.x'
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install pip --upgrade
|
|
25
|
+
python -m pip install build
|
|
26
|
+
- name: Build
|
|
27
|
+
run: python -m build
|
|
28
|
+
- name: Publish
|
|
29
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
fail-fast: false
|
|
10
|
+
matrix:
|
|
11
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
- name: Setup Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python-version }}
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install pip --upgrade
|
|
22
|
+
python -m pip install -r requirements.txt
|
|
23
|
+
- name: Test
|
|
24
|
+
run: python -m pytest
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
98
|
+
__pypackages__/
|
|
99
|
+
|
|
100
|
+
# Celery stuff
|
|
101
|
+
celerybeat-schedule
|
|
102
|
+
celerybeat.pid
|
|
103
|
+
|
|
104
|
+
# SageMath parsed files
|
|
105
|
+
*.sage.py
|
|
106
|
+
|
|
107
|
+
# Environments
|
|
108
|
+
.env
|
|
109
|
+
.venv
|
|
110
|
+
env/
|
|
111
|
+
venv/
|
|
112
|
+
ENV/
|
|
113
|
+
env.bak/
|
|
114
|
+
venv.bak/
|
|
115
|
+
|
|
116
|
+
# Spyder project settings
|
|
117
|
+
.spyderproject
|
|
118
|
+
.spyproject
|
|
119
|
+
|
|
120
|
+
# Rope project settings
|
|
121
|
+
.ropeproject
|
|
122
|
+
|
|
123
|
+
# mkdocs documentation
|
|
124
|
+
/site
|
|
125
|
+
|
|
126
|
+
# mypy
|
|
127
|
+
.mypy_cache/
|
|
128
|
+
.dmypy.json
|
|
129
|
+
dmypy.json
|
|
130
|
+
|
|
131
|
+
# Pyre type checker
|
|
132
|
+
.pyre/
|
|
133
|
+
|
|
134
|
+
# pytype static type analyzer
|
|
135
|
+
.pytype/
|
|
136
|
+
|
|
137
|
+
# Cython debug symbols
|
|
138
|
+
cython_debug/
|
|
139
|
+
|
|
140
|
+
# PyCharm
|
|
141
|
+
.idea/
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: character-encoding-utils
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: Some character encoding utils.
|
|
5
|
-
Author: TakWolf
|
|
6
|
-
Maintainer: TakWolf
|
|
7
|
-
License: MIT License
|
|
8
5
|
Project-URL: homepage, https://github.com/TakWolf/character-encoding-utils
|
|
9
6
|
Project-URL: source, https://github.com/TakWolf/character-encoding-utils
|
|
10
7
|
Project-URL: issues, https://github.com/TakWolf/character-encoding-utils/issues
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
Author: TakWolf
|
|
9
|
+
Maintainer: TakWolf
|
|
10
|
+
License: MIT License
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: big5,encoding,gb2312,ksx1001,shift-jis
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
16
|
Requires-Python: >=3.10
|
|
16
17
|
Description-Content-Type: text/markdown
|
|
17
|
-
License-File: LICENSE
|
|
18
18
|
|
|
19
19
|
# Character Encoding Utils
|
|
20
20
|
|
|
@@ -32,7 +32,7 @@ Now support:
|
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
34
34
|
|
|
35
|
-
```
|
|
35
|
+
```shell
|
|
36
36
|
pip install character-encoding-utils
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
1
5
|
[project]
|
|
2
6
|
name = "character-encoding-utils"
|
|
3
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.7"
|
|
4
8
|
description = "Some character encoding utils."
|
|
5
9
|
readme = "README.md"
|
|
6
10
|
license = { text = "MIT License" }
|
|
@@ -24,6 +28,7 @@ source = "https://github.com/TakWolf/character-encoding-utils"
|
|
|
24
28
|
issues = "https://github.com/TakWolf/character-encoding-utils/issues"
|
|
25
29
|
|
|
26
30
|
[tool.pytest.ini_options]
|
|
27
|
-
pythonpath =
|
|
28
|
-
|
|
31
|
+
pythonpath = "src"
|
|
32
|
+
addopts = [
|
|
33
|
+
"--import-mode=importlib",
|
|
29
34
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest==8.2.0
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: character-encoding-utils
|
|
3
|
-
Version: 0.0.5
|
|
4
|
-
Summary: Some character encoding utils.
|
|
5
|
-
Author: TakWolf
|
|
6
|
-
Maintainer: TakWolf
|
|
7
|
-
License: MIT License
|
|
8
|
-
Project-URL: homepage, https://github.com/TakWolf/character-encoding-utils
|
|
9
|
-
Project-URL: source, https://github.com/TakWolf/character-encoding-utils
|
|
10
|
-
Project-URL: issues, https://github.com/TakWolf/character-encoding-utils/issues
|
|
11
|
-
Keywords: encoding,gb2312,big5,shift-jis,ksx1001
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
-
Classifier: Operating System :: OS Independent
|
|
15
|
-
Requires-Python: >=3.10
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
License-File: LICENSE
|
|
18
|
-
|
|
19
|
-
# Character Encoding Utils
|
|
20
|
-
|
|
21
|
-
[](https://www.python.org)
|
|
22
|
-
[](https://pypi.org/project/character-encoding-utils/)
|
|
23
|
-
|
|
24
|
-
Some [character encoding](https://en.wikipedia.org/wiki/Character_encoding) utils.
|
|
25
|
-
|
|
26
|
-
Now support:
|
|
27
|
-
|
|
28
|
-
- [GB2312](https://en.wikipedia.org/wiki/GB_2312)
|
|
29
|
-
- [Big5](https://en.wikipedia.org/wiki/Big5)
|
|
30
|
-
- [Shift-JIS](https://en.wikipedia.org/wiki/Shift_JIS)
|
|
31
|
-
- [KS-X-1001](https://en.wikipedia.org/wiki/KS_X_1001)
|
|
32
|
-
|
|
33
|
-
## Installation
|
|
34
|
-
|
|
35
|
-
```commandline
|
|
36
|
-
pip install character-encoding-utils
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Usage
|
|
40
|
-
|
|
41
|
-
### GB2312
|
|
42
|
-
|
|
43
|
-
```python
|
|
44
|
-
from character_encoding_utils import gb2312
|
|
45
|
-
|
|
46
|
-
bs = gb2312.encode('abc中国')
|
|
47
|
-
assert gb2312.decode(bs) == 'abc中国'
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Big5
|
|
51
|
-
|
|
52
|
-
```python
|
|
53
|
-
from character_encoding_utils import big5
|
|
54
|
-
|
|
55
|
-
bs = big5.encode('abc中國')
|
|
56
|
-
assert big5.decode(bs) == 'abc中國'
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Shift-JIS
|
|
60
|
-
|
|
61
|
-
```python
|
|
62
|
-
from character_encoding_utils import shiftjis
|
|
63
|
-
|
|
64
|
-
bs = shiftjis.encode('abc日本')
|
|
65
|
-
assert shiftjis.decode(bs) == 'abc日本'
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### KS-X-1001
|
|
69
|
-
|
|
70
|
-
```python
|
|
71
|
-
from character_encoding_utils import ksx1001
|
|
72
|
-
|
|
73
|
-
bs = ksx1001.encode('abc가쳰')
|
|
74
|
-
assert ksx1001.decode(bs) == 'abc가쳰'
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## License
|
|
78
|
-
|
|
79
|
-
Under the [MIT license](LICENSE).
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
src/character_encoding_utils/__init__.py
|
|
5
|
-
src/character_encoding_utils/big5.py
|
|
6
|
-
src/character_encoding_utils/gb2312.py
|
|
7
|
-
src/character_encoding_utils/ksx1001.py
|
|
8
|
-
src/character_encoding_utils/shiftjis.py
|
|
9
|
-
src/character_encoding_utils.egg-info/PKG-INFO
|
|
10
|
-
src/character_encoding_utils.egg-info/SOURCES.txt
|
|
11
|
-
src/character_encoding_utils.egg-info/dependency_links.txt
|
|
12
|
-
src/character_encoding_utils.egg-info/top_level.txt
|
|
13
|
-
tests/test_big5.py
|
|
14
|
-
tests/test_gb2312.py
|
|
15
|
-
tests/test_ksx1001.py
|
|
16
|
-
tests/test_shiftjis.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
character_encoding_utils
|
|
File without changes
|
|
File without changes
|
|
@@ -5,21 +5,21 @@ class Big5Exception(Exception):
|
|
|
5
5
|
|
|
6
6
|
class Big5EncodeError(Big5Exception):
|
|
7
7
|
def __init__(self, obj: str, position: int, reason: str):
|
|
8
|
+
super().__init__(f"'big5' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
8
9
|
self.object = obj
|
|
9
10
|
self.position = position
|
|
10
11
|
self.reason = reason
|
|
11
|
-
super().__init__(f"'big5' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Big5DecodeError(Big5Exception):
|
|
15
15
|
def __init__(self, obj: bytes, position: int, reason: str):
|
|
16
|
-
self.object = obj
|
|
17
|
-
self.position = position
|
|
18
|
-
self.reason = reason
|
|
19
16
|
if len(obj) <= 1:
|
|
20
17
|
super().__init__(f"'big5' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
|
|
21
18
|
else:
|
|
22
19
|
super().__init__(f"'big5' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
|
|
20
|
+
self.object = obj
|
|
21
|
+
self.position = position
|
|
22
|
+
self.reason = reason
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def encode(cs: str) -> bytes:
|
|
@@ -8,21 +8,21 @@ class GB2312Exception(Exception):
|
|
|
8
8
|
|
|
9
9
|
class GB2312EncodeError(GB2312Exception):
|
|
10
10
|
def __init__(self, obj: str, position: int, reason: str):
|
|
11
|
+
super().__init__(f"'gb2312' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
11
12
|
self.object = obj
|
|
12
13
|
self.position = position
|
|
13
14
|
self.reason = reason
|
|
14
|
-
super().__init__(f"'gb2312' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class GB2312DecodeError(GB2312Exception):
|
|
18
18
|
def __init__(self, obj: bytes, position: int, reason: str):
|
|
19
|
-
self.object = obj
|
|
20
|
-
self.position = position
|
|
21
|
-
self.reason = reason
|
|
22
19
|
if len(obj) <= 1:
|
|
23
20
|
super().__init__(f"'gb2312' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
|
|
24
21
|
else:
|
|
25
22
|
super().__init__(f"'gb2312' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
|
|
23
|
+
self.object = obj
|
|
24
|
+
self.position = position
|
|
25
|
+
self.reason = reason
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def encode(cs: str) -> bytes:
|
|
@@ -8,21 +8,21 @@ class KSX1001Exception(Exception):
|
|
|
8
8
|
|
|
9
9
|
class KSX1001EncodeError(KSX1001Exception):
|
|
10
10
|
def __init__(self, obj: str, position: int, reason: str):
|
|
11
|
+
super().__init__(f"'ksx1001' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
11
12
|
self.object = obj
|
|
12
13
|
self.position = position
|
|
13
14
|
self.reason = reason
|
|
14
|
-
super().__init__(f"'ksx1001' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class KSX1001DecodeError(KSX1001Exception):
|
|
18
18
|
def __init__(self, obj: bytes, position: int, reason: str):
|
|
19
|
-
self.object = obj
|
|
20
|
-
self.position = position
|
|
21
|
-
self.reason = reason
|
|
22
19
|
if len(obj) <= 1:
|
|
23
20
|
super().__init__(f"'ksx1001' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
|
|
24
21
|
else:
|
|
25
22
|
super().__init__(f"'ksx1001' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
|
|
23
|
+
self.object = obj
|
|
24
|
+
self.position = position
|
|
25
|
+
self.reason = reason
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def encode(cs: str) -> bytes:
|
|
@@ -7,21 +7,21 @@ class ShiftJISException(Exception):
|
|
|
7
7
|
|
|
8
8
|
class ShiftJISEncodeError(ShiftJISException):
|
|
9
9
|
def __init__(self, obj: str, position: int, reason: str):
|
|
10
|
+
super().__init__(f"'shift-jis' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
10
11
|
self.object = obj
|
|
11
12
|
self.position = position
|
|
12
13
|
self.reason = reason
|
|
13
|
-
super().__init__(f"'shift-jis' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class ShiftJISDecodeError(ShiftJISException):
|
|
17
17
|
def __init__(self, obj: bytes, position: int, reason: str):
|
|
18
|
-
self.object = obj
|
|
19
|
-
self.position = position
|
|
20
|
-
self.reason = reason
|
|
21
18
|
if len(obj) <= 1:
|
|
22
19
|
super().__init__(f"'shift-jis' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
|
|
23
20
|
else:
|
|
24
21
|
super().__init__(f"'shift-jis' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
|
|
22
|
+
self.object = obj
|
|
23
|
+
self.position = position
|
|
24
|
+
self.reason = reason
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def encode(cs: str) -> bytes:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|