?
Solved

Pound (Sterling) sign in console app.

Posted on 2005-04-08
3
Medium Priority
?
556 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:Havin_it
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 13735632
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
 
LVL 10

Author Comment

by:Havin_it
ID: 13735797
Sorted! Can't believe I ignored that part.

Easiest points you ever made?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13735915
:-)

>>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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question