1

I have this code

     String [] currency = {"US Dollar", "Philippine Peso", "British Pound", "Japanese Yen", "Indian Rupee",
                                    "Syrian Pound"};
   char [] symbol = { '\u0024', '\u20B1', '\u00A3','\u00A5', '\u20AC'};

I want the output to have this format: this is in a for loop:

System.out.println("\t\t"+ currency[i] + " ======> "+ symbol[i] + sell[i]

I want the output to show the currency symbol, but it is showing different characters. please help

eLg
  • 519
  • 4
  • 11
  • 25
  • 2
    For me its showing correct output though$ ? £ ¥ € – sanbhat Apr 28 '13 at 11:49
  • 1
    It showed the correct values except for "Peso" with cp1252 encoding. Change your console's encoding to UTF-8 and you should be good. – Shashank Kadne Apr 28 '13 at 11:50
  • wait..How to change the console to UTF-8? – eLg Apr 28 '13 at 12:15
  • If you are trying it in a command prompt, use `chcp 65001`. In eclipse, you can change it from Run Configurations-> Common->Console Encoding. It is default cp1252. Change it to UTF-8 – Shashank Kadne Apr 28 '13 at 12:25
  • I am using textpad. I am using a command prompt. Can you tell me the steps please? – eLg Apr 28 '13 at 12:42
  • 1
    You could start your program with `java MainClass > output.txt` and take a look at output.txt with a hex editor to verify that your Java program is correct and that your issues are related to the terminal. – Micha Wiedenmann Apr 28 '13 at 20:04

0 Answers0