1

I have a problem with the charset on my program. Using netbeans, when I run my program, on the output window opçõesshows as expected but using command prompt it shows like opþ§es.

On project properties, encoding is set to UTF-8 so I changed to windows-1252 (I believe that this is the portuguese charset) and now opções shows as op├º├Áes.

How can I fix this to opções shows as opções?

favolas

Favolas
  • 6,963
  • 29
  • 75
  • 127

1 Answers1

2

Don't change anything in your program. If it works correctly in NetBeans, then it runs correctly. You're seeing strange characters in the Windows command prompt because it doesn't handle non-ascii chars correctly. The problem is in the Windows command prompt, not in your program.

See Unicode characters in Windows command line - how?

Community
  • 1
  • 1
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
  • Sweet. But to work as expected, charset must be set as windows-1252 and after typing chcp 65001 everything shows as it should – Favolas Jan 01 '12 at 14:23
  • actually, the code may not be correct, it may just happen to work correctly depending on the platform character encoding. hard to tell anything without seeing code. – jtahlborn Jan 01 '12 at 14:24