This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Special character string display

 
Nehel Patel
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am parsing the xml which i am getting from serverside, and displaying the string on Android UI.

At one tag of xml I am getting some special characters "Atrévete a Soñar". On android phone and wordpad it shows same, But If I open same xml in mozilla it shows same string as "Atrévete a Soñar". I want to display this on Android UI same like how it shows in mozilla. Is there any string conversion code in JAVA by which I can do this?

Thanks in advance
Nehel
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What encoding is the file in? How are you handling that?
 
Nehel Patel
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not done any encoding. Let me know if I neet to to do any encoding. This is simple text (string) coming from server and I am displaying on android UI.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every time you have text that goes beyond US-ASCII you need to concern yourself with encoding. Start by finding out which encoding the XML file is in that the server sends you; being XML, it may have that information in ?xml processing directive. If so, make sure that the actual encoding is the same as what's specified by that directive.
 
Nehel Patel
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey I got the solution




I did this and now I am getting Spanish characters correctly instead of junk characters.
output: strSpanish : Atrévete a Soñar (how I wanted ) :-)

I have reffered below link
http://java.sun.com/developer/technicalArticles/Intl/HTTPCharset/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic