Hello everyone,
I’m stuck with a problem concerning the default encoding used by the Integration Server’s JVM in version 9.5.
Every method I tried to get the default encoding returned an alias of US-ASCII:
Charset dCharset = Charset.defaultCharset();
String name = dCharset.name();
String displayName = dCharset.displayName();
Both methods above return “US-ASCII”.
byte b = (byte)'a';
byte [] byteArray = {b};
InputStream inputStream = new ByteArrayInputStream(byteArray);
InputStreamReader reader = new InputStreamReader(inputStream);
String defaultEncoding = reader.getEncoding();
This returns “ASCII”.
String fileEncoding = System.getProperty("file.encoding");
This returns “ANSI_X3.4-1968”.
The IS is running on RedHat and when I try to see what is the default locale and charset of the system I get the following results (with the same user that also executes IS):
> locale
LANG=fr_FR@euro
LC_CTYPE="fr_FR@euro"
LC_NUMERIC="fr_FR@euro"
LC_TIME="fr_FR@euro"
LC_COLLATE="fr_FR@euro"
LC_MONETARY="fr_FR@euro"
LC_MESSAGES="fr_FR@euro"
LC_PAPER="fr_FR@euro"
LC_NAME="fr_FR@euro"
LC_ADDRESS="fr_FR@euro"
LC_TELEPHONE="fr_FR@euro"
LC_MEASUREMENT="fr_FR@euro"
LC_IDENTIFICATION="fr_FR@euro"
LC_ALL=
> locale charmap
ISO-8859-15
I didn’t set the “Dfile-encoding” option in setenv.sh or anywhere else, neither did I set the “-Duser.language” or “-Duser.region” options.
On another RedHat machine with the same locale, same charset and IS 7.1.3, we don’t have this problem, the JVM’s default charset is ISO-8859-15.
Trouble is, when we run old code that uses pub.string.stringToBytes or pub.string.bytesToString without specifying the encoding (I know it’s bad), we lose all non-ascii characters. I know I can use the “Dfile-encoding” option to solve this, but I’d like to understand where the JVM gets that US-ASCII configuration from.
Anyone knows what could be happening here? Is there a configuration somewhere that eludes me?