02.12.2010 13:54, HippoMan пишет:
PS: I am writing Android-specific code. The class I am using will
never work outside of the Android environment, for reasons that go
beyond the issue of character encoding.
So does this mean that in my case, I _should_ do the moral equivalent
of this?
String content = new String(bytes,
System.getProperty("file.encoding"));
No, you shouldn't.
file.encoding is a system-wide property, and if it matches *your
application's* content, it's only by pure luck.
These are your files, you should know what encoding they are in.
If they are UTF-8, go ahead and specify that encoding in your code.
A side note - perhaps every actual Android firmware sets file.encoding
to UTF-8, but I don't see any guarantees to that in the SDK documentation.
If so, this would indeed reduce to the following:
String content = new String(bytes);
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
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