• Post Reply Bookmark Topic Watch Topic
  • New Topic

Non-English characters in Java code  RSS feed

 
Danish Shaukat
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have read that Java source code is in Unicode characters.

Does this mean that I can create a string in Chinese using Chinese language and then display it. Or will I have to add escaped unicode in order to display Chinese.

If I create a string using Chinese language, the Chinese gets converted to question marks in the code.
 
Nik lammar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the same problem with Greek characters, so, I am posting this to
update the question, if anyone can help us...
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Save your code in UTF8 format, and it will work fine. If your default file encoding is ISO Latin, what you are trying won't work.

In Eclipse, the file encoding is a project-level property (Info tab.)
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, I would add that strictly speaking, it's not non-English characters, it's non-Latin characters. English is one of more than 40 languages that uses the Latin script. Just some theory!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!