Pound (Sterling) sign in console app.

Hi all,

I've just begun learning Java and seem to be having a problem with character encoding. It's essentially the same issue as was covered here:

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21231791.html

Except that the fix in that thread, the command 'chcp 1252', hasn't made any difference.

I'm in the UK, so I can type the Pound sign natively into any app. such as the Notepad++ I use for coding.
But when I run the Java app. that uses it (a simple console string-manipulation thing), I always get the wrong character.
I found two Unicode values for the symbol:

\u00A3 - gives a lowercase 'u' with acute accent
\u20A4 - gives a question mark (?)

Typing the character natively into the program gives me the 'u'. In fact, after chcp 1252, that's what I get if I type the same key in the console.

Notepad++ has the option to encode the .java source file as UTF-8, but if I do this I get compiler errors for characters at the very start of the file (where I can't actually see any characters - 'public....' should be right at the start) and the character that's displayed is still wrong.

Any idea how I can remedy this? Thanks in advance.
LVL 10
Havin_itAsked:
Who is Participating?
 
CEHJCommented:
After

chcp 1252

do the following:

1. Right-click the title bar of the console window
2. Choose properties
3. Choose 'Lucida Console' as the font

Voila

0
 
Havin_itAuthor Commented:
Sorted! Can't believe I ignored that part.

Easiest points you ever made?
0
 
CEHJCommented:
:-)

>>Easiest points you ever made?

No, the whole manoeuvre (although you knew most of it already, and the worst bits) is actually quite obscure ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.