Open NightFurySL2001 opened 3 years ago
Which version of Windows are you on? I tried with a clean Chinese install of the latest Windows 10, but I can't reproduce so far using the same command. I can get a 'gbk' error with Python if I do some other things like try to print Korean, but not with makeotf. Did you edit any of the Source Han Sans files before running makeotf? Are there other characters in your path?
I was on Windows 10 20H2. Trying to open a UTF-8 file when system is configured to GBK will make Python open("filename")
containing non-ASCII characters results in the same 'gbk' error. There was a fix around this issue, which is to turn on Beta: Use Unicode UTF-8 for worldwide language support
in Control Panel - Clock and Region - Change date, time, or number formats - Administrative - Change system locale...
which will force all programs to read files with UTF-8.
Source files for my project (which I did modified) is on https://github.com/NightFurySL2001/maoken-heavy-labourer.
There are no other characters in my path, it's just E:\edit old dot\build_final_otf
.
It seems to be related to a problem with subprocess
that universal_newlines=True
and stdout=PIPE
will force decoding of the child process' output using locale.getpreferredencoding(False)
, which is not UTF-8 for language-locale system. Mine return cp936
instead of cp65001
when I didn't check the option above.
A fix could be as such: https://github.com/adobe-type-tools/afdko/blob/42ad89290a42015dcdf2dfd778d826e928bf9b9b/python/afdko/fdkutils.py#L112
out = proc.communicate().encode("utf-8")[0]
I am trying to build a font with
makeotf
as below:My system have used Chinese (PRC) in the settings for localization, and Python by default reads all files as GBK. Does this requires a fix?