Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Chinese problems in Java

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail the sample analysis of Java Chinese problems for everyone. Xiaobian thinks it is quite practical, so share it with you for reference. I hope you can gain something after reading this article.

Let me tell you how tomcat implements JSP and you will understand.

Preparatory knowledge:

1. Byte and unicode

Java kernel is unicode, even class files are, but a lot of media, including file/stream storage

is using byte streams. So Java has to translate these byte streams into lines. char is unicode and byte is byte.

Java byte/char conversion function in the middle of the package sun.io. where ByteToCharConverter is scheduled

It can be used to tell you which converter you use. Two very common static functions are

public static ByteToCharConverter getDefault() ;

public static ByteToCharConverter getConverter(String encoding);

If you do not specify converter, the system automatically uses the current Encoding, GBK on GB,EN on EN

8859_1

Let's take a simple example:

GB code for "you" is 0xC 4E3,unicode is 0x4F 60

You use:

--encoding="gb2312";

--byte b[]={(byte)'u00c4',(byte)'u00E3'};

--convertor=ByteToCharConverter.getConverter(encoding);

--char [] c=converter.convertAll(b);

--for(int i=0;i

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report