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


Other Threads

1. Android 2.1 Source

Hi, is there any where that I am able to download the source of 2.1?
All I've been able to find is 2.2. Thanks.

-- 

2. Need to optimize some graphics calls.

Hey all,

I'm looking for some help optimizing some bitmap drawing code.

Here's my pseudo-code:

draw() {

lockCanvas()

drawbackgroundBitmap()

for (100times) {
 drawbitmap(x,y);
}

unlockCanvas()

}

That inner loop is my bottleneck.  It is taking 160ms to run the whole
function.  80% of that is spent making the drawBitmap calls in the
loop.  Is there a faster method to draw the bitmaps.  The bitmaps are
basically a fifo (actually an Arraylist) where new ones are added and
old ones are removed.  Would openGL help?

Thanks in advance.

-- 

3. Mapping 6 faces of cube with 6 different images

4. confirm the android os whether implement to parse the WAP PUSH message or not?

5. Some issues about lock the screen orientation

6. How to create Custom AutoCompleteTextView ?

7. AT&T Samsung Captivate > mExternalStorageAvailable == false;