1

I have a problem with string encoding in my Java application. My Informix database has ISO-8859-2 encoding. I have set DB_LOCALE in a connection string. My connection URL looks like:

jdbc:informix-sqli://test/test:informixServer=test;portNumber=1542;databaseName=test;serverName=test_informix;ifxIFXHOST=test;DB_LOCALE=pl_PL.8859-2;DBDATE=Y4MD-;IFX_LOCK_MODE_WAIT=10;

After selecting data from database, Polish special characters are not recognised by Java String. charAt() method returns 65533 code.

I tried to look at hex code of that string:

String.format("%040x", new BigInteger(1, input.getBytes("ISO-8859-2"))));

And the result is valid. Any ideas where is the problem?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
bartex9
  • 391
  • 3
  • 19

1 Answers1

1

I managed to find out the solution. The problem was in LANG system variable. It was empty on my machine. After changing it to en_US.ISO-8859-1 strings are handled properly.

bartex9
  • 391
  • 3
  • 19