java - Which charset should I use to encode and decode 8 bit values? -
I have a problem with decoding encoding and specific byte values. I am applying an application, where I need to get string data, there is a need to manipulate it and return the second string.
I currently byte []
String.getbytes ()
is manipulating, and then the string is generated by the string by the manufacturer (byte [] Data is returning
. The problem is, when certain bytes have specific values eg -120
, -127
, etc., coding in constructor ?
returns the character, which is a byte value 63
. As far as I know, these are the values that can not be printed on Windows, related to the fact that in Java there is -120
10001000
, that < According to code>
Is there a charset, do I properly code every byte value And can I use to decode (128 to 127)? : I would also say that, ISO-8859-1
charset works very well, but the code does not do special characters, such as ąęćśńźżół
There is some confusion about encoding, will not be specific , so I will try to help clean some .
There are no letters nor encodings that use code numbers from -128 to 0, do not exist. If you treat byte as an unsigned integer, then you get the 0-255 range all valid for cp- * and isoo-8859- * charsets.
ASCII characters are in the range of 0-127 and therefore it is valid that you treat it as integral as signed or unsigned.
In the UTF-8 letter either 0-127 or with the first byte of double byte characters, limit 128-255.
You mention some Polish characters, so instead of ISO-8859-1, you need ISO-8859-2 or (preferably) UTF-8 .
Comments
Post a Comment