This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes The java compiler and encoding of sourcde file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "The java compiler and encoding of sourcde file." Watch "The java compiler and encoding of sourcde file." New topic
Author

The java compiler and encoding of sourcde file.

Tim McMurry
Greenhorn

Joined: Oct 31, 2009
Posts: 22
Hi,

I have a source file from a repository that causes a warning when I compile on my local machine:

"Unmappable character for encoding UTF8"

I have googled and found a "fix", which is to specify an encoding as an optional parameter when invoking the compiler.

However, I have always heard that Java sources could use Unicode, so whats up ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
javac can handle source files in just about any encoding, but it needs to be specified using the switch you found. I think the default is to assume US-ASCII encoding.


Ping & DNS - updated with new look and Ping home screen widget
Tim McMurry
Greenhorn

Joined: Oct 31, 2009
Posts: 22
Ok,

then I get it, I assumed the claim about Unicode meant that the compiler itself would figure things out.

Thanks for the reply

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The java compiler and encoding of sourcde file.
 
Similar Threads
Java version in build file
Reg :UTF 8
Unicode issue(for Arabic)
Encoding in Java file
file name encoding problem