I'm creating a POS GUI system and have had no trouble with using any currency symbols in the program so far. When I brought another file of code across into my main class for my GUI, I now suddenly have the symbol  appearing before the '£' symbol I have.
I've tried changing the original files encoding to make sure its in UTF-8, then copy it over, but it still appears.
This is an example of the generating I'm doing for each component in the code:
btnSubTwoOptionOne.setSize(135,50);
btnSubTwoOptionOne.addActionListener(this);
btnSubTwoOptionOne.setBackground( new Color(-10027162) );
btnSubTwoOptionOne.setText("Meat Pie £2.20");
panelMainSubTwo.add(btnSubTwoOptionOne);
Hope someone can help me with this. :)
The problem seems to be that the source file is in UTF-8, but you're compiling the code using windows-1252.
The £
( Unicode Character 'POUND SIGN' (U+00A3) ) is encoded in UTF-8 as C2 A3
. If you decode those two bytes in windows-1252 , you get Â
( C2
) and £
( A3
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.