Java , Unix & Spanish Characters
September 30, 2010 at 1:59 pm Leave a comment
Had a problem with Spanish Characters , JDK1.6 , Oracle 10g in Unix Environment.
The country name “Panamá” when retrieved from database was displayed in application log with a question mark (?) instead of “á” .
When connecting to DB with sqlplus from Unix box and viewing the value using select query was also displaying the same question mark.
The character set of DB was UTF8 which could store Spanish characters properly.
So where is the problem??…
When connecting to DB with NLS_LANG set to WE8ISO8859P1 showed proper Spanish characters in place. So the issue was not at the DB end.
Our java application was getting screwed up for some strange reasons.
Solution to the issue was to start the java application with correct file.encoding parameter.
Unix box was having the default file.encoding US-ASCII which will not handle Spanish characters properly.
So starting application as : java -Dfile.encoding=ISO-8859-1 would override the default and use the correct character set correctly which solved the issue.
Entry filed under: tips and tricks. Tags: Java, Unix & Spanish Characters.
Trackback this post | Subscribe to the comments via RSS Feed