Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError #62

Closed
fluffyloopy opened this issue May 11, 2023 · 4 comments
Closed

UnicodeEncodeError #62

fluffyloopy opened this issue May 11, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@fluffyloopy
Copy link

What happened ?

mangadex-dl https://mangadex.org/title/cb77e4a6-3921-43b9-9d64-7d78cd3205ce --save-as tachiyomi

What did you expect to happen ?

start downloading the manga information along with it

OS version

Windows 10 20H2

App version

mangadex-downloader v2.9.0 (https://github.com/mansuf/mangadex-downloader)
Python: 3.10.11
arch: x64
bundled executable: yes

Installation origin

Github releases

Installation origin (other sources)

No response

Reproducible command

mangadex-dl https://mangadex.org/title/cb77e4a6-3921-43b9-9d64-7d78cd3205ce --save-as tachiyomi

Additional context

No response

@fluffyloopy fluffyloopy added the bug Something isn't working label May 11, 2023
@mansuf
Copy link
Owner

mansuf commented May 12, 2023

Can you show me the error traceback ?

The traceback should look like this

[INFO] Checking url = 433e77d2-5a58-48a3-95b8-e3c02f309255
[ERROR] Unhandled exception, Exception: Test error
Traceback (most recent call last):
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\cli\__init__.py", line 71, in _main
    download(args)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\cli\download.py", line 33, in download
    url(args, args.type)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\cli\url.py", line 165, in __call__
    self.func(self.id, args)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\cli\url.py", line 96, in download_manga
    dl_manga(*args)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\main.py", line 60, in download
    raise Exception("Test error")
Exception: Test error

It would been better if you give me full logs.

@fluffyloopy
Copy link
Author

[WARNING] format `tachiyomi` is deprecated, please use `raw` or `cbz` format with `--write-tachiyomi-info` instead
[INFO] Checking url = https://mangadex.org/title/cb77e4a6-3921-43b9-9d64-7d78cd3205ce
[INFO] Using English language
[INFO] Fetching all chapters...
[INFO] Downloading cover manga Jigokuraku
[INFO] File exist and replace is False, cancelling download...
[INFO] Download directory is set to "D:\Software\mangadex-dl\Jigokuraku"
[INFO] Using tachiyomi format
[INFO] Writing tachiyomi `details.json` file
[ERROR] Unhandled exception, UnicodeEncodeError: 'cp932' codec can't encode character '\xe2' in position 342: illegal multibyte sequence
Traceback (most recent call last):
  File "mangadex_downloader\cli\__init__.py", line 71, in _main
  File "mangadex_downloader\cli\download.py", line 33, in download
  File "mangadex_downloader\cli\url.py", line 165, in __call__
  File "mangadex_downloader\cli\url.py", line 96, in download_manga
  File "mangadex_downloader\main.py", line 168, in download
  File "mangadex_downloader\main.py", line 138, in download_manga
  File "mangadex_downloader\format\raw.py", line 44, in main
  File "mangadex_downloader\format\base.py", line 240, in write_tachiyomi_info
  File "mangadex_downloader\format\utils.py", line 253, in write_tachiyomi_details
UnicodeEncodeError: 'cp932' codec can't encode character '\xe2' in position 342: illegal multibyte sequence

@mansuf
Copy link
Owner

mansuf commented May 13, 2023

After further debugging, it seems your windows system locale is set to Japanese (Correct me if i'm wrong).

Logs
[ERROR] Unhandled exception, UnicodeEncodeError: 'cp932' codec can't encode character '\xe2' in position 342: illegal multibyte sequence
Traceback (most recent call last):
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\cli\__init__.py", line 71, in _main
    download(args)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\cli\download.py", line 33, in download
    url(args, args.type)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\cli\url.py", line 165, in __call__
    self.func(self.id, args)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\cli\url.py", line 96, in download_manga
    dl_manga(*args)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\main.py", line 168, in download
    download_manga(manga, base_path)
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\main.py", line 138, in download_manga
    fmt.main()
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\format\raw.py", line 44, in main
    self.write_tachiyomi_info()
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\format\base.py", line 240, in write_tachiyomi_info
    write_tachiyomi_details(self.manga, (self.path / "details.json"))
  File "D:\NextcloudSync\PROJECT\Programming\mangadex-downloader\mangadex_downloader\format\utils.py", line 256, in write_tachiyomi_details
    writer.write(json_op.dumps(data))
UnicodeEncodeError: 'cp932' codec can't encode character '\xe2' in position 342: illegal multibyte sequence

This is the same error traceback as yours if i set manually the file encoding to "cp932" which is Japanese windows character encoding.

I've submit a patch that would fix this issue, you can test it by downloading a patched version in https://github.com/mansuf/mangadex-downloader/actions/runs/4968080319.

You can download it once the CI shows success, and the files is available under "Artifacts" section

@fluffyloopy
Copy link
Author

yes it's set to japanese and i'm not getting the issue with the patched version. thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants