开发者

How to add diffrent characterset support for JtextArea?

开发者 https://www.devze.com 2023-01-01 07:12 出处:网络
I need to display a document, which is in Cp037 character Encoding, in JTextArea? I 开发者_如何学Pythonthink JTextArea by default supports UNICODE character encoding. How to add Cp037 charater setsupp

I need to display a document, which is in Cp037 character Encoding, in JTextArea? I 开发者_如何学Pythonthink JTextArea by default supports UNICODE character encoding. How to add Cp037 charater set support to JTextArea?


JTextArea only support Java char, which uses UTF-16BE encoding. If you have some byte-stream in CP037, you need to convert it to String or Char array first.

For example, if you have characters in Cp037 as a byte array, you should do this,

  String text = new String(bytes, "Cp037");

You may need to install extra charset support for certain JREs.


Doesn't JTextArea use UTF-8 for output? Important if you generate code you want to use in eclipse. Got some problems with § over there.

0

精彩评论

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