I am trying understand how I can return the extended ASCII decimal value for characters in the 128 to 159 range using the default Windows codepage instead of a negative value.
Example
String character = new String(new byte[] { (byte) 150 }, "Cp1252");
System.out.println("character: " + character);
System.out.println(Arrays.toString(character.getBytes("Cp1252")));
Results
character: –
[-106]
Instead of returning 150 in this exampe it returns -106. I am just beginning to understand
Java and signed numbers. How can I code a module to return decimal 150 instead of -106?
I am examining an input file and would like to replace extended ascii characters with a printable character based on the value returned in getBytes()