Problem with Chinese characters in Linux environment with SQL Server 2005

I am trying to get Chinese characters from a SQL Server 2005 database server using my web application hosted on a Jboss server in a Linux box (RHEL). The problem is that Chinese characters are never returned from the database, instead, square fields are displayed. For this, I tried both JTDS drivers and SqlJdbc drivers from Microsoft. Interestingly, the same combination of database and drivers works fine in a Windows environment with Chinese characters returned in a string from the result set.

Any help on this would be greatly appreciated.

+6
source share
1 answer

Actually there is not enough information about what you are doing with the data, between the time that it leaves the database and the time that it displays in the view. It might be nice to print some debugging information on both Linux and Windows to see what differences exist for certain system properties, for example, if you exit System.getProperty ("file.encoding") in both scenarios, which You are getting?

You might want to try using JAVA_OPTS = -Dfile.encoding = UTF-8.

Perhaps a discussion on the link below may help.

https://community.jboss.org/thread/155260?_sscc=t

It doesn't seem to be a database / driver issue.

+1
source

Source: https://habr.com/ru/post/905639/


All Articles