This discussion is archived
0 Replies Latest reply: Mar 20, 2013 6:47 PM by 998211 RSS

java Label object not displaying ascii chars (128-159)

998211 Newbie
Currently Being Moderated
I am having a problem getting ASCII characters between 128 and 159 to show up in a Label object which is inside a Panel which is in turn inside a Frame. There is other code in a different class that uses a Graphics object and drawString and Paint methods to display the same text, and that works. However, simply passing the text containing the above mentioned ascii characters like so:

lb = new Label("€‚ƒ„…†‡");

results in mostly empty boxes being displayed (there is other code that eventually displays the label in the Frame). The Euro sign comes through, as does the integral sign. Some others come through, and they are mostly modifed letters of some sort.

I've tried coding a mock up simple Frame with a few labels. I've passed in literal strings, String objects derived from hex and integer byte arrays and a String object with the Cp1252 encoding passed in. None display the characters in question. However, in the same code, I pass a title string containing these characters into the Frame's constructor, and it appears with no problems.

I just want to be able to handle all characters that may be entered into this application, and that may include these Cp1252 characters. Is there any way of using Label objects and getting these characters to display correctly?

[Windows-1252 Chart|http://upload.wikimedia.org/wikipedia/commons/e/e7/Windows-1252.svg]

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points