antlr / antlr4-tools

Tools to run antlr4 w/o needing to install java or antlr4!
MIT License
82 stars 19 forks source link

Update antlr4_tool_runner.py #12

Open TheVeryDarkness opened 1 year ago

TheVeryDarkness commented 1 year ago

Add a system property for jre, so that System.out always uses UTF-8 encoding.

TheVeryDarkness commented 1 year ago

I met an error about encoding as decsribed in #antlr4/a. In short, system.out in org.antlr.v4.gui.Interpreter may use other encoding such as GBK if not explicitly specified. I thought it should be solved in java side, but later I found just a “-Dfile.encoding=UTF-8” is enough. By the way, after adding this, an encoding can be added to arguments passed to subprocess.Popen in interp().