Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Special character string display  RSS feed

 
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
 
Rancher
Posts: 42975
76
  • 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: 42975
76
  • 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/
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!