bartex9
bartex9

Reputation: 391

Informix JDBC ISO-8859-2 encoding problem

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?

Upvotes: 1

Views: 1016

Answers (1)

bartex9
bartex9

Reputation: 391

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.

Upvotes: 1

Related Questions