aspose file tools*
The moose likes Android and the fly likes Special character string display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Special character string display" Watch "Special character string display" New topic
Author

Special character string display

Nehel Patel
Greenhorn

Joined: Feb 09, 2010
Posts: 21
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
Marshal

Joined: Mar 22, 2005
Posts: 41905
    
  63
What encoding is the file in? How are you handling that?


Ping & DNS - my free Android networking tools app
Nehel Patel
Greenhorn

Joined: Feb 09, 2010
Posts: 21
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
Marshal

Joined: Mar 22, 2005
Posts: 41905
    
  63
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

Joined: Feb 09, 2010
Posts: 21
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/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Special character string display