adapap / OWScript

Python-like scripting language which transpiles into Overwatch Workshop script rulesets.
MIT License
37 stars 2 forks source link

Fix text encoding when saving to a file #21

Closed netux closed 5 years ago

netux commented 5 years ago

Things like the "ö" in Torbjörn and the "ú" in Lúcio were becoming invalid ascii characters.

Also, added a warning when transpiling directly to the console and the console's encoding isn't utf-8

adapap commented 5 years ago

Running this through the VSCode extension still shows a warning message. Could be that the exec function from node's child_process module, or not reading properly from the user's environment in my case. I found that the encoding was set to cp1252 when compiling through the extension.

netux commented 5 years ago

Can you make VSCode execute set PYTHONIOENCODING=utf_8 or specify the encoding on the options when executing the script? child_process.exec's defaults are encoding utf-8.

As a last resource, we could add an argument to ignore the warning, something like --no-utf8-warning