File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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: 42913
    
  68
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.
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.