No, that's not a bug. Here's a rule that you should always follow: If an operation has a version that takes an encoding -- use it, and specify "UTF-8". NEVER use the one that does not. And never use anything other than UTF-8 unless you are very specifically interfacing with other encodings, and you can't change them to UTF-8.
Your second println line violates that rule, and the behavior will be unpredictable and outside of your control. You don't know what that second println does, or when it would change. Will it change from release to release? Device to device? When the user changes settings? When the user moves to a different location and the carrier changes things? On Bastile day? You just don't know, so you don't ever, ever, want to use it. And any chance you get to convert something to UTF-8/ISO-10646 from some other encoding, do so. It's long past time for things to move into the modern world. In particular, it's time to drive railroad spikes into the coffin of the ISO-8859-* family of encodings. And the Windows encodings? Break out the flame throwers! On Nov 8, 8:46 am, Simon MacDonald <[email protected]> wrote: > Hi all, > > I'm wondering if I found a bug in Android. When I run this code on my > laptop: > > String myData = "hockey,marché,football"; > byte[] rawData; > rawData = myData.getBytes("UTF-8"); > > System.out.println("UTF-8 decoded: "+new String(rawData,"UTF-8")); > System.out.println("Default decoded: "+new String(rawData)); > > I get the output: > > *UTF-8 decoded: hockey,marché,football* > *Default decoded: hockey,marché,football* > > However, when I run the same code in an Android application and view the > output it "adb logcat" I get: > > *D/FileUtils( 485): UTF-8 decoded: hockey,march∩┐╜,football* > *D/FileUtils( 485): Default decoded: hockey,march∩┐╜,football* > > I get the same issue if I change the locale of my phone to French (Canada) > as well. It doesn't seem like French characters are getting encoded > properly. > > Any thoughts? > > Simon Mac Donaldhttp://hi.im/simonmacdonald -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

