![]() |
Python 3.6.10 fails when running a localized script. - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Python 3.6.10 fails when running a localized script. (/thread-28220.html) |
Python 3.6.10 fails when running a localized script. - Mikee - Jul-09-2020 Hello, Thanks for having me here. I am a new to python. I am stuck with something which i think most of you might already know. I have a py script that contains some Japanese (localized) strings. When i run this script in Python.exe version 3.6.10 it throws an error like: 'SyntaxError: Non-UTF-8 code starting with '\xe5' in file (..) but no encoding declared' Can anyone let me know how to resolve it! ![]() Thanks a ton. RE: Python 3.6.10 fails when running a localized script. - Gribouillis - Jul-09-2020 If the program is not encoded in UTF-8, you could add en encoding line as the first or the second line of the program, such as # -*- coding: <encoding name> -*-For a list of encoding names, you could list the content of the encodings directory in the python library. I don't know japanese at all but for example iso2022-jp-1 looks like a candidate for <encoding name>
RE: Python 3.6.10 fails when running a localized script. - Mikee - Jul-09-2020 @Gribouillis : That magical line helped. Thanks a ton. |