helloShen / leetcode-helper

Save your time from building scaffolding for each leetcode problem.
345 stars 43 forks source link

Encoding error during compilation #4

Closed LiZeC123 closed 5 years ago

LiZeC123 commented 5 years ago

When I compile my first java file, there is an error

compile:
     [echo] Compile source code for problem two_sum ...
    [javac] Compiling 2 source files to C:\Users\lizec\LeetCode\bin
    [javac] C:\Users\lizec\LeetCode\src\test\java\com\leetcode\two_sum\Tester.java:27: 错误: 编码GBK的不可映射字符
    [javac]     /**=========================== 銆恠tatic for different test cases銆? ============================== */
    [javac]                                                                     ^
    [javac] C:\Users\lizec\LeetCode\src\test\java\com\leetcode\two_sum\Tester.java:59: 错误: 编码GBK的不可映射字符
    [javac]     /**=========================== 銆恌or each test case銆? ============================== */
    [javac]                                                        ^
    [javac] 2 个错误

These unrecognized symbols are Chinese brackets. I can be sure that all those code files are encoded with UFT-8, so I am wondering if the compilation process is related to file encoding or there are some error in my java configuration. My OS is Win10, and java version is 1.8.0_171.

这些未识别的符号似乎是中文的括号,即我可以肯定所有的代码文件都是UTF-8编码,所以我想知道这个编译过程是否和文件编码存在关系,或者是我在Java的配置上存在问题。我的操作系统版本是win10, java版本是1.8.0_171。

LiZeC123 commented 5 years ago

个人认为没有必要使用中文符号,可以直接删除,此处修改已经提交pull request

helloShen commented 5 years ago

pull accepted. You can still compile as below to avoid encoding problem. javac -encoding utf-8 MyClass.java