博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Globalize your On Demand Business
阅读量:4185 次
发布时间:2019-05-26

本文共 2619 字,大约阅读时间需要 8 分钟。

Globalize your On Demand Business

<script language="JavaScript" type="text/JavaScript"> </script>
 
Supporting GB18030 In Web Applications : Retrieve and Display data

We use a JSP file GB18030.jsp to retrieve the GB18030 data in DB2 database via JDBC. In GB18030.jsp, we do not call the methods such as response.setLocale() and response.setContentType(). And then the parameter “charset” in GB18030.jsp determines the value of response.getCharacterEncoding().

We assume the GB18030 data in two kinds of format. One is in Unicode format (UTF-8 or UCS-2). The other is in HTML character references format such as &#xxxxx.

 

Retrieve and Display GB18030 data in Unicode format

There are two results when retrieving GB18030 data:
Figure 6 When the data is retrieved correctly.

Figure 7 When the data is retrieved NOT correctly.

And here is the summary table according to the different charset parameters in GB18030.jsp:

charset parameter in GB18030.jsp

Result

charset=GB18030

Success (Figure 6)

charset=GB2312

Fail (Figure 7)

charset=ISO-8859-1

Fail (Figure 7)

charset=UTF-8

Success (Figure 6)

Retrieve and Display GB18030 data in character references format

Because the HTML character references format such as &#13313 is an encoding-independent character, every View > Encoding can parse the data correctly:

Charset parameter in GB18030.jsp

Result

Charset=GB18030

Success (Figure 6)

Charset=GB2312

Success (Figure 6)

Charset=ISO-8859-1

Success (Figure 6)

Charset=UTF-8

Success (Figure 6)

IE and Netscape’s behavior of displaying GB18030 data in kinds of objects

In GB18030.jsp file, we define HTML objects of Text Area, Text Field, List Box and Drop Down Menu. We retrieve the GB18030 data into these objects. However, we find that IE 6.0 has the weakness to display GB18030 data in some objects, while Netscape 7.0 behaves well.
The weakness of IE 6.0 is that it displays GB18030 data in square in some objects as following though the IE’s font is already set to GB18030 font. The symptom is the same for the IE on Windows XP.

Here is a summary table about this behavior:

HTML objects

IE 6.0

Netscape 7.0

Text Area

OK

OK

OK

Display as Square

OK

List Box

Display as Square

OK

Drop Down Menu

Display as Square

OK

 

 

 

 

 

 

 

 

 

 

Amendment:Explicitly set the font “SimSun-18030” to be used by the objects: in the HTML file, add “ STYLE="font-family:'SimSun-18030' ” as each object’s attribute, and then, GB18030 data display correctly.

IE and Netscape’s behavior of displaying surrogate data

With GB18030.jsp file, we can see that the surrogate data can display correctly in the above four objects both in Netscape 7.0 and IE 6.0, for example,

 

转载地址:http://fayoi.baihongyu.com/

你可能感兴趣的文章
java的非对称加密算法
查看>>
spring方法拦截器 MethodInterceptor
查看>>
Greenplum八点劣势是真的吗
查看>>
hbase与传统数据的区别
查看>>
Green Plum测试报告
查看>>
javax.crypto加密
查看>>
java判断socket是否断开
查看>>
java获得IP
查看>>
UDP丢包及无序的现象
查看>>
java的反射
查看>>
java的Calendar类
查看>>
列式数据库
查看>>
jsp中post方式请求乱码
查看>>
Java截图
查看>>
Collections的随机排序
查看>>
Java遍历Map的四种方法及对比
查看>>
libsvm的经典总结(全面至极)
查看>>
身份证合法性校验
查看>>
System.getProperties(); //系统属性
查看>>
java读取clob字段的方法
查看>>