Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage Chatacters

 
Sameera Abeysekara Abeysekara
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write code to retrieves data from access database using ODBC connection but database contains Japanese characters.
when retrieve Japanese text and display using servlet(creating html) but Japanese character garbage.

then i solved this problem when i deployed in jbuilder bundled tomcat. i change language to Japaneses using regional settings then i created "USER DSN".
when i use jbuilder bundled tomcat its work properly(i mean show Japaneses text properly).

then i tried to deploy in side the i manually installed tomcat it doesn't work(i mean Japaneses characters garbaged).

how can i solve this problem.


thanks
sameera
 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sameera,
In your servlet set the content type to UTF-8 for example something like this response.setContentType("text/html;charset=UTF-8").

Hope this helps.

Regards,
Sivaraman.L
 
Sameera Abeysekara Abeysekara
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for advice i already set the character set to UTF-8.
then how can i solve this problem?
do you have any ideas?

thanks
sameera
 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can you try this request.setCharacterEncoding("UTF-8"); in the init method of the servlet.
 
Sameera Abeysekara Abeysekara
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can't place that method in init() method.there is no request variable.

thanks
sameera
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic