On Tue, Jun 30, 2009 at 8:16 PM, Hiro<[email protected]> wrote:
> I can resolve this by omitting the input parametter in getBytes as
> follows.
>
> unicode = new String(unicode.getBytes(), "ISO-2022-JP");
>
> It seems to me getBytes("ISO-2022-JP") won't work...

Upon rereading your example, it's not clear what you're trying to accomplish.

In case this helps, the call:

    new String(bytes, encoding)

will construct a String based on bytes in the given encoding, so if
you have a bunch of ISO-2022-JP bytes, then you can say

    new String(iso2022bytes, "ISO-2022-JP")

and then you should find that you have a normal string (which itself
consists of Unicode UTF-16 code points).

In your original example, you say:

    new String(jis)

which will construct a string by interpreting the bytes in the default
encoding. The default encoding on Android is UTF-8, so this is
probably not what you want.

My apologies that I didn't notice this earlier.

-dan

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to