开发者

How to identified given string is double byte characterset using java?

I want to Identify given string开发者_高级运维 is double byte character set or not, using java?

Thanks


A String does not have a character set property, in fact, it is always UTF-16 (16 bit used for each char).


If you wanted to try to discover the likely charset of some input data (e.g. in a file or stream), then the ICU4J CharsetDetector could be used.

But by the time the data is in a String in your code, it is too late.


Your string has multibyte characters if String.codePointCount(int beginIndex, int endIndex) for the whole text range will give not zero result.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜