question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows : Forced outputs do not have proper encoding, causing for Chinese output "UnicodeEncodeError"

See original GitHub issue

full err log

Traceback (most recent call last):
  File "F:\print_chinese.dist\print_chinese.py", line 3, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-7: ordinal not in range(128)

my nutika version: at frist i use 0.6.19rc7, then i tried 0.7.7, 0.8.3, and factory version 0.9rc4, both of them has the same error as above python -m nuitka --version

0.8.3
Commercial: None
Python: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
Flavor: Unknown
Executable: D:\softwares\py39\python.exe
OS: Windows
Arch: x86_64
WindowsRelease: 10

build script nuitka --standalone --mingw64 --windows-disable-console --windows-force-stdout-spec=F:\print_chinese.log --windows-force-stderr-spec=F:\print_chinese_err.log print_chinese.py

example code:

l = [('扫描时间:2022年06月02日 11:42\n操作员:user1', None, 1)]
print(l)

this error only shown in standlone mode and console disabled by --windows-disable-console , it works well while console is opened, setting PYTHONIOENCODING as this issue said didn’t work for me, i guess it has been set in python 3.9 already

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Jun 5, 2022

Fixed on factory branch. https://nuitka.net/doc/factory.html

0reactions
kayhayencommented, Jun 23, 2022

Part of the 0.9 release that I just made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chinese characters SOMETIMES not decoded properly in ...
Chinese characters SOMETIMES not decoded properly in Windows 10 · Press Windows key + X. · Click Control Panel. · Click Clock, Language,...
Read more >
How to fix: "UnicodeDecodeError: 'ascii' codec can't decode ...
The correct way to banish encoding errors in Py2 is to unambiguously decode and encode (byte) strings to Unicode, when conversions are necessary...
Read more >
3 Using Unicode in Erlang
The standard binary encoding is used whenever a library function in Erlang is to handle Unicode data in binaries, but is of course...
Read more >
Using UTF-8 as the internal representation for strings in C and ...
We simply need to ensure that all text is encoded as UTF-8, rather than a narrow region-dependent set of characters such as the...
Read more >
Character Encoding - Unreal Engine Documentation
Does not work when the game detects the string is ASCII and outputs it as such ... would be cross referenced with the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found