Hello everyone,
What are the guidelines i should follow to avoid encoding issues when reading files or converting string to bytes, bytes to streams streams to reader etc. Any important notes, tutorials would also help.
Best Regards, Keshav
Hello everyone,
What are the guidelines i should follow to avoid encoding issues when reading files or converting string to bytes, bytes to streams streams to reader etc. Any important notes, tutorials would also help.
Best Regards, Keshav
String<->byte[]
conversion is not always fully possible. So avoid it if possible. (see this question)
when reading (the same goes for writing) a stream specify the desired encoding using
new InputStreamReader(inputStream, charset)
My advice is to use java.io.Reader
/ java.io.Writer
if possible, and set the character when you use InputStreamReader
/ OutputStreamWriter
.