Skip to main content
added 195 characters in body; added 13 characters in body
Source Link
tangens
  • 39.8k
  • 21
  • 128
  • 140

You should make the conversion explicitly:

byte[] byteArray = "abcd".getBytes( "ISO-8859-1" ); new String( byteArray, "ISO-8859-1" ); 

EDIT:

It seems that the problem is the encoding of your java file. If it works on windows, try compiling the source files on linux with javac -encondig ISO-8859-1. This should solve your problem.

You should make the conversion explicitly:

byte[] byteArray = "abcd".getBytes( "ISO-8859-1" ); new String( byteArray, "ISO-8859-1" ); 

You should make the conversion explicitly:

byte[] byteArray = "abcd".getBytes( "ISO-8859-1" ); new String( byteArray, "ISO-8859-1" ); 

EDIT:

It seems that the problem is the encoding of your java file. If it works on windows, try compiling the source files on linux with javac -encondig ISO-8859-1. This should solve your problem.

Source Link
tangens
  • 39.8k
  • 21
  • 128
  • 140

You should make the conversion explicitly:

byte[] byteArray = "abcd".getBytes( "ISO-8859-1" ); new String( byteArray, "ISO-8859-1" );