How to specify the encoding of Java source files?

I used strange Unicode strings in java test cases The compiler seems to interpret the file as ISO - 8859 - 1, causing JUnit to complain

In Python, I can specify the encoding at the top of the file:

# -*- coding: utf-8 -*-

Is there a considerable in Java? How to detect / specify Java file encoding?

Solution

You can use the parameter "- encoding" to set when compiling files

http://docs.oracle.com/javase/6/docs/technotes/tools/windows/javac.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>