Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Undesired Characters in My Strings

 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a jQuery call I need to send some values to a remote database.

I am sending values like

3.51±.030
6.25±.030

but when checked at the servlet the values are like

3.51±.030
6.25±.030

I have tried escape(var ref) but then I get a value like

3.51%B1.030
 
Paul Clapham
Sheriff
Posts: 21126
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have encoding problems. Read this article:

http://java.sun.com/developer/technicalArticles/Intl/HTTPCharset/
 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changing the charset=UTF-8 does not make any difference. I am changing the META tag on my jsp page.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like this?



I have run into a similar problem with production code, the data that was being returned as actually stored with the wrong content type. That was fun to figure out since it only failed on Ajax calls.

Eric
 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help.

The display from the database displayed ok. However when I updated the data is when the extra character would get appended. What I did was add the following to my servlet and is seems to have solved the problem:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic