• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Special character string display

 
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: 43016
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: 43016
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/
 
No holds barred. And no bars holed. Except this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic