Issues with character encoding please help?

by Moto » Wed, 21 Apr 2010 12:10:17 GMT

Sponsored Links
 I get an array of bytes and I convert that to a String in the
following way:
blockString = new String(tagBlock);

The results are good for english and some other languages but Russian,
Spanish, Chinese, and many others aren't displayed properly...  The
only way to diplay correctly is to find the correct encoding and
decode the language like this:
blockString = new String(tagBlock,"ISO8859_1");

But how can I do this better?  How can I not have to worry about
string encoding?  It's turning out to be a problem back in Japan and
other countries with my app :(

Thanks for any help!


Issues with character encoding please help?

by Moto » Wed, 21 Apr 2010 19:47:27 GMT

 I'm sure I'm doing something wrong!?


Sponsored Links

Issues with character encoding please help?

by Moto » Thu, 22 Apr 2010 08:42:10 GMT

 I guess no one runs into this kind of issues...???

> >

Issues with character encoding please help?

by Bob Kerns » Thu, 22 Apr 2010 15:09:27 GMT

 No, it's just that I've already told everyone else on the planet (it
seems) not to do this! I've been crusading on this for decades... :=)

Do not ever use the String(byte[]) constructor.

Do not ever pass up an opportunity to explicitly supply a character

Always use UTF-8 when you have control over the encoding. But Never,
ever, leave it to the platform default. You must always find out the
encoding somewhere.

If it really is just a bunch of bytes of unknown encoding, and you
can't change that, then you will need to allow the user to make an
alternative selection -- but start with UTF-8 as the default if at all

Nobody, anywhere, should be using anything but UTF-8 for new data
these days. The world has moved far beyond all these petty national

So the first thing is to ask -- where do these bytes come from? If
they're not already in UTF-8, can I change something to get them in
UTF-8? If not, can I get the supplier of these bytes to tell me what
encoding they're in (such as the Content-Type: HTTP file)? If not, how
can I let the user tell me the encoding and character set, if I guess

> > >

Other Threads

1. Some confusion on resource IDs

I'm just getting into developing my app, which will have quite a
number of activities and thus quite a few XML files to lay out the
screens and define all the views. What I'm just seeing is that if I
assign the IDs using "@+id/name", I'll have to have a unique name for
every widget on every screen since all the symbols get defined in one
big file.

Or can I just generate the definitions once in one of the XML files
and then reference them in the other layout files? For example, if I
have a TextView that I'd like to call "surname" in multiple layout
files, can I declare it one of the files using "@+id/surname" and then
simply use "@id/surname" in the other files? I assume that as long as
all the IDs are unique within a layout file, all is OK.


2. Problem Installing app


I am working on a Android application , When i tried to download the My App
to My Motorola Droid 2.2 ,It gives an error that "Problem in parsing",I am
using Ecllipse and Api 2.1 for development, Please let me know what could be
the issue.

Please help.

*Thanks and Regards
Ajmer Singh*


3. two programming questions about 'twitter for android' app

4. Reducing List sizes

5. executing the command ping on Android?

6. Internet Connection Bug Or Error ??

7. How can i set background image for an ImageView dynamically???