Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

MSSQL and Unicode in WIndows and Linux

Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java application reads mssql table data (unicode data) and forward to servlet. This scenario works fine when I run application in Ubuntu. But performance changes for these following scenarios:

secnario1: i move java application to windows which forwards database data to servlet running in ubuntu. Output in java app shows question marks (unicode issue) but servlet shows them correctly.

Scenario2: move both java app and servlet to windows, now both modules displaying question marks.

What I think - it should not be problem with database data since jdbc driver in linux works fine. But when I read data from windows (using same driver, later different versions of jdbc driver), though it shows ?? but servlet in linux could manage to get unicode data. What could be the problem and what should I do?

Thank you in advance.
Posts: 43016
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where does it show question marks? Some kind of console? A web page? A console most likely can't display those characters. A web page needs to specify the proper encoding.

Make sure that you're specifying UTF-8 as the encoding wherever the data gets sent from one system to another.
Ahsan Habib
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For java app, I log output into file, and I run servlet in tomcat from eclipse - so, can see output in eclipse console.

I guess i figured out the problem. It was not jdbc driver problem. I changed Standards and Formats in Regional and Language settings (windows control panel) to Thai (before it was english) and now java app logs unicode data (read from mssql table) properly in log file. But eclipse console still show question marks. Later, I switched to jetty, and eclipse console prints Thai character properly. It was tomcat limitation. Adding UTF-8 for url handling in server.xml in tomcat solved the problem.

Worth to note that I was using apache HttpClient to forward data to servlet.
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic