Unicode in javadoc and comments?

后端 未结 2 739
感情败类
感情败类 2021-01-11 09:51

Some compilers failed on non-ASCII characters in JavaDoc and source code comments. What is the current (Java 7) and future (Java 8 and beyond) practices with respect to Unic

2条回答
  •  不知归路
    2021-01-11 10:33

    As commenters indicated, the encoding of the source files can be passed to (at least some) compilers. In this answer, I will summarize how to pass this information.

    Eclipse

    Eclipse (3.7 checked) does not require any special configuration, and you can happily use Java source code like:

    double π = Math.PI;
    

    Ant

    
    
    

    Java

    javac -encoding UTF-8 src/main/Foo.java
    

提交回复
热议问题