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. LocalServiceBinding.java

Hi guys.

I'm writing an application that use a service to play an audio file

I'm watching the LocalService.java and LocalServiceBinding.java
from the API DEMO

In the api demo, the LocalService.java make a notification in the
status bar, in my case it plays mp3 and make a notification. But that
doesn't matter.


My problem is that when the user press the "Back Button" the service
must stay active.
I want have the same behaviour as  when i press the "Home Button"...


Any help is welcome :D

ps:sorry for my eng

-- 

2. Customising Spinner Popup Lists (horizontalDivider)

Hi,

I'm having trouble changing the drawable resource used to draw the
horizontal divider in the spinners popup list.

If I do the following in styles.xml, I am able to change every part of
the popup list except the horizontal divider graphic. I'm even able to
change the divider height!

<resources>
        <style name="MyTheme">
            <item name="android:spinnerDropDownItemStyle">@style/
Widget.DropDownItem.Spinner</item>
            <item name="android:listViewStyle">@style/Widget.ListView</item>
            <item name="android:alertDialogStyle">@style/AlertDialog</item>
         </style>


        <style name="Widget.DropDownItem.Spinner" parent="@android:style/
Widget.DropDownItem.Spinner">
                <item name="android:checkMark">@drawable/radio_button</item>
                <item name="android:textStyle">bold</item>
                <item name="android:textColor">@color/white</item>
        </style>

        <style name="Widget.ListView" parent="android:Widget.ListView">
                <item name="android:listSelector">@drawable/
my_list_selector_background</item>
                <item name="android:horizontalDivider">@drawable/my_divider</
item>
                <item name="android:dividerHeight">10dip</item>
        </style>

        <style name="AlertDialog" parent="@android:style/AlertDialog">
          <item name="android:topDark">@drawable/my_popup_top_dark</item>
          <item name="android:bottomBright">@drawable/my_popup_bottom_dark</
item>
        </style>
</resources>

No matter what I try I can't stop it from using the default in-built
divider graphic.

Does anyone know how to change the horizontal divider graphic specific
to the spinner widgets popup list?

Cheers,
Nilz.

-- 

3. DB location

4. Detecting the presence of a mute switch

5. when do we get "Timeout of broadcast BroadcastRecord" message?

6. Linking libraries fails

7. managedQuery - Nullpointerexception