Actually I'm having some trouble with the display encoding in my terminal window on mac.
I'm running a simple program in Java:
And after the compiling when i run that code I face with this result:
The number of the variable z
do not match the exact unicode value!
All my preferences are set to UTF-8, in the editor and also in my terminal, but I can't find a way to solve this problem!
UPDATE:
Also here the writing and the compiling of the program:
Thanks in advance!
Using the following Java program:
/* A.java */
class A
{
public static void main (String[] args)
{
for (char c = 'A'; c < 270; c++)
{
System.out.print(c);
}
System.out.println();
}
}
then I get the following output:
$ java -Dfile.encoding=ASCII A
Default Charset: US-ASCII
abcdefghijklmnopqrstuvwxyz{|}~??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
$ java -Dfile.encoding=iso-8859-1 A
Default Charset: ISO-8859-1
abcdefghijklmnopqrstuvwxyz{|}~��������������������������������������������������������������������������������������������������������������������������������??????????????
$ java -Dfile.encoding=UTF-8 A
Default Charset: UTF-8
abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČč
$ java A
Default Charset: UTF-8
abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČč
From the above you can see that ISO-8859-1 prints both '�' and '?'. The '�' means that it was not valid UTF-8, and the terminal could not print it, and the '?' means that Java could not convert the required character into that character set. This is why ASCII only has '?', as it can only convert ASCII characters.
The default file.encoding is taken from from your locale, which is why you may need to set your LC_CTYPE. Otherwise, your terminal needs to be set to understand UTF-8.
$ echo $LC_CTYPE
UTF-8