problem with spanish characters in android app

by bobetko » Thu, 19 May 2011 04:33:33 GMT


Sponsored Links
 I have issue with spanish characters in java string. I have a content
RSS feed and when i try to transform it to java object using
InputStreamReader, I get outputs like "cmo" which should be "cmo".
This is happening with other spanish characters like

 =   =   =   =   = 

and more..

How can I convert these characters to proper spanish characters?

Here is how my InputStreamReader looks like:

Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"),
1024);

I tried doing my own method like this:
public static String fixSpanish(String s)
    {
        s = s.replaceAll("", "");
        s = s.replaceAll("", "");
        s = s.replaceAll("", "");
        s = s.replaceAll("", "");
        s = s.replaceAll("", "");
        Log.d(TAG, s);
        return s;
    }

But, this didn't work. None of search combinations are ever found.
Any ideas?

Thanks in advance

-- 



Re: problem with spanish characters in android app

by Kostya Vasilyev » Thu, 19 May 2011 04:50:32 GMT


 Is your input stream really UTF-8?

I would dump the data you're getting somewhere as bytes (or look at it 
in the debugger if it's small) and double check the character set.


The accented "o" is 0xF3 in ISO-8859-1

 http://www.fileformat.info/info/unicode/char/f3/index.htm 

In UTF-8, the 0xF3 is a special character prefix, used by, among other 
things, mathematical symbols:


 http://download.oracle.com/docs/cd/B10501_01/server.920/a96529/appb.htm #952448

-- Kostya

19.05.2011 0:33, bobetko :
I have issue with spanish characters in java string. I have a content RSS feed and when i try to transform it to java object using InputStreamReader, I get outputs like "cmo" which should be "cmo". This is happening with other spanish characters like = = = = = and more.. How can I convert these characters to proper spanish characters? Here is how my InputStreamReader looks like: Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"), 1024); I tried doing my own method like this: public static String fixSpanish(String s) { s = s.replaceAll("", ""); s = s.replaceAll("", ""); s = s.replaceAll("", ""); s = s.replaceAll("", ""); s = s.replaceAll("", ""); Log.d(TAG, s); return s; } But, this didn't work. None of search combinations are ever found. Any ideas? Thanks in advance
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --


Sponsored Links