开发者

Android set character encoding

How can I set the encoding of EditText value?

I tried this but it does not seem to w开发者_JS百科ork.

String test = new String(myField.getText().toString().getBytes(), "Cp1251");

The receiver still has invalid value.


A string is always internally (in the String class) stored as unicode.

You should specify the encoding when you convert the string to bytes, and are sending the data.

That is, invoke getBytes(String encoding) on the string, and send the resulting byte array to the receiver.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜