You are here: Articles > Computers & Technology > jsp

 See more articles about "jsp "

JSP and JSTL Tutorials - Tutorial Addendum - Localization Internationalization - Non ASCII Characters in JSP Pages



 31 December 18:00   

    



    



    

(Continued from antecedent part...)

    



    

In adjustment to analysis out how to ascendancy those factors, I best two simplified

    

Chinese characters, and entered them in 7 altered formats as a simple HTML paragraph:

    

 

    

<p>

    

GB2312-binary: ?=(0xCBB5C3F7)<br/>

    

GB2312-#xHEX: &#xCBB5;&#xC3F7;<br/>

    

GB2312-uHEX: uCBB5uC3F7<br/>

    

Unicode-binary: 明=(0x8bf4660e)<br/>

    

Unicode-#xHEX: &#x8bf4;&#x660e;<br/>

    

Unicode-uHEX: u8bf4u660e<br/>

    

Unicode-UTF8: ??=(0xE8AFB4E6988E)<br/>

    

</p>

    



    



    

Hex numbers are provided next to the bifold codes, just in case if you accept

    

trouble to archetype this book to your bounded system.

    



    

In the next 3 sections, I will put this branch into a approved HTML file, a JSP page with

    

standard syntax, and a JSP page with XML syntax to see how Bobcat server will catechumen them

    

into Java chic files and in what incodings.

    



    

Static HTML Argument - HTML Page

    



    

In the first test, the changeless argument is amid into a approved HTML file:

    

 

    

<html>

    

<!-- StaticGB2312.html

    

Absorb (c) 2002 by Dr. Yang

    

-->

    

<body>

    

<p>

    

GB2312-binary: ?=(0xCBB5C3F7)<br/>

    

GB2312-#xHEX: &#xCBB5;&#xC3F7;<br/>

    

GB2312-uHEX: uCBB5uC3F7<br/>

    

Unicode-binary: 明=(0x8bf4660e)<br/>

    

Unicode-#xHEX: &#x8bf4;&#x660e;<br/>

    

Unicode-uHEX: u8bf4u660e<br/>

    

Unicode-UTF8: ??=(0xE8AFB4E6988E)<br/>

    

</p>

    

</body>

    

</html>

    



    



    

Now appearance StaticGB2312.html with IE, and try to change the encoding action

    

in the Appearance menu. After-effects bout my expectations except one area:

    



        

  • Westen European (Windows): Unicode-#xHEX band shows up correctly. I wasn t

        

    expecting this, and had no abstraction why.

        



  •     

  • Chinese Simplified (GB2312): GB2312-binary band shows up correctly.

        



  •     

  • Unicode (UTF-8): Unicode-UTF8 band shows up correctly.

        



  •     



    



    

Since this is not a JSP, Bobcat will not catechumen it into a Java chic file.

    

I am using this analysis to validate that the codes are entered correctly.

    



    

Static HTML Argument - JSP Page in Accepted Syntax

    



    

In the additional test, the changeless argument is amid into a JSP page in accepted syntax:

    

 

    

<%@ page contentType="text/html; charset=gb2312" %>

    

<!-- StaticGB2312.jsp

    

Absorb (c) 2002 by Dr. Yang

    

-->

    

</html>

    

</body>

    

<p>

    

GB2312-binary: ?=(0xCBB5C3F7)<br/>

    

GB2312-#xHEX: &#xCBB5;&#xC3F7;<br/>

    

GB2312-uHEX: uCBB5uC3F7<br/>

    

Unicode-binary: 明=(0x8bf4660e)<br/>

    

Unicode-#xHEX: &#x8bf4;&#x660e;<br/>

    

Unicode-uHEX: u8bf4u660e<br/>

    

Unicode-UTF8: ??=(0xE8AFB4E6988E)<br/>

    

</p>

    

</body>

    

</html>

    



    



    

If you appearance this page in IE, you will that see both GB2312-binary band and Unicode-#xHEX

    

line are displayed correctly. Actuality is the explanation:

    



        

  • The "charset" amount gb2312 in the page charge account tells Bobcat to apprehend

        

    this JSP files as GB2312

        

    encoding. So GB2312-binary band is decoded accurately into Unicode codes.

        



  •     

  • All additional bifold curve are decoded incorrectly, because they are not GB2312 codes.

        



  •     

  • Uicode-#xHEX band is not decoded, because they are accustomed ASCII characters.

        



  •     

  • When breeding the Java chic file, all strings are encoded as UTF-8. This is the

        

    default ambience of Tomcat. You can change this in the conf/web.xml file.

        



  •     

  • The "charset" amount gb2312 aswell tells Bobcat to change the encoding to GB2312 on

        

    the "out" object, and the Conten-Type HTTP header, so the generated HTML certificate will

        

    in GB2312 encoding.

        



  •     



    



    

To appove the aloft explanation, actuality is the accompanying curve of the generated Java chic file:

    

 

    

...

    

response.setContentType("text/html; charset=gb2312");

    

...

    

out.write("<p>
GB2312-binary: ??=(0xCBB5C3F7)");

    

out.write("<br/>
GB2312-#xHEX: &#xCBB5;&#xC3F7;");

    

out.write("<br/>
GB2312-\uHEX: \uCBB5\uC3F7");

    

out.write("<br/>
Unicode-binary: ??明=(0x8bf4660e)");

    

out.write("<br/>
Unicode-binary: ----=(0x8bf4660e)");

    

out.write("<br/>
Unicode-#xHEX: &#x8bf4;&#x660e;");

    

out.write("<br/>
Unicode-\uHEX: \u8bf4\u660e");

    

out.write("<br/>
Unicode-UTF8: ????=(0xE8AFB4E6988E)");

    

...

    



    



    

If you change the "charset" to utf-8, I am abiding Unicode-UTF8 band will be displayed

    

correctly. You understand why.

    



    

By the way, "charset" can aswell be defined as "pageEncoding"

    

in the "page" charge statement.

    

(Continued on next part...)

    



    



 


 gb2312, unicode, binary, x660e, write, correctly, uhex, charset, tomcat, 0x8bf4660e, unicode, change, class, static, codes, 0xe8afb4e6988e, 0xcbb5c3f7, xcbb5, xc3f7, x8bf4, characters, decoded, gb2312, encoding, u8bf4u660e<, ascii, staticgb2312, ucbb5uc3f7<, syntax, shows, , xhex &, write <, gb2312 binary, unicode utf8, & x660e, unicode xhex, utf8 0xe8afb4e6988e, & x8bf4, java class, < body, < html, x660e 0x8bf4660e, jsp page, x8bf4 &, xcbb5 &, & xc3f7, & xcbb5, binary 0xcbb5c3f7, text html, gb2312 xhex, change the, class file, binary line, line shows, 0xcbb5c3f7 <, 0xe8afb4e6988e <, ascii characters, uhex ucbb5uc3f7<, unicode binary, gb2312 uhex, x660e <, xc3f7 <, uhex u8bf4u660e<, unicode uhex, 0x8bf4660e <, & xcbb5 &, xcbb5 & xc3f7, & x8bf4 &, x8bf4 & x660e, xhex & xcbb5, xhex & x8bf4, gb2312 xhex &, unicode utf8 0xe8afb4e6988e, gb2312 binary line, java class file, unicode xhex &, unicode uhex u8bf4u660e<, gb2312 binary 0xcbb5c3f7, gb2312 uhex ucbb5uc3f7<, page directive statement, text html charset, html charset gb2312, unicode utf8 line, charset value gb2312, static html text, tutorials tutorial notes, tutorial notes localization, notes localization internationalization, regular html file, jstl tutorials tutorial, non ascii characters,

Share JSP and JSTL Tutorials - Tutorial Addendum - Localization Internationalization - Non ASCII Characters in JSP Pages:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

JSP and JSTL Tutorials - Tutorial Addendum - Localization Internationalization - Non ASCII Characters in JSP Pages
i(Continued from antecedent part...)/iStatic HTML Argument JSP Page in XML SyntaxIn the third test, the changeless argument is amid into a JSP page in XML syntax:br

JSP and JSTL Tutorials - Tutorial Addendum - JSP Achievement
Calculating Prime NumbersThe first breadth I wish to analysis for achievement is accumulation addition calculations. The afterward JSP page calculates prime amount starting from amo

JSP and JSTL Tutorials - Tutorial Addendum - JSP Achievement
i(Continued from antecedent part...)/iResponse Time of "Hello" PageThe next breadth I wish analysis is absolute acknowledgment time of ASP pages. To do this, I wroteth

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve
This affiliate describes:HTTP Acknowledgment SyntaxHTTP Acknowledgment Attack LinesControlling Attack LinesViewing Attack Linesbr

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve
i(Continued from antecedent part...)/i2. Acknowledgment attack lines: Advice about the response: Accept Ranges Age ETag Area

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve
i(Continued from antecedent part...)/iOnce the Web browser finishes processing the article body, you can get some bound informationfrom the attack lines. For example, you can bang the appropriate abrasion button

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve
i(Continued from antecedent part...)/i2. Command: "php HttpRequestGet.php /dot.gif" gives us: HTTP/1.1 200 OKServer: Microsoft IIS/5.1Date: Sun, 13 Nov 2005 04:40:17 GMTCon

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve
i(Continued from antecedent part...)/iHere is the output: HTTP/1.1 200 OKServer: Microsoft IIS/5.1Date: Sat, 19 Nov 2005 02:28:32 GMTContent Type: text/xml;charset=utf 8br

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve
i(Continued from antecedent part...)/iGenerating Non HTML Article BodySometimes, you may wish to forward aback advice in the article physique that are not in the HTML

JSP and JSTL Tutorials - Tutorial Addendum - Authoritative HTTP Acknowledgment Attack Curve
i(Continued from antecedent part...)/iSending Files for DownloadingIn the antecedent section, the requested book is delivered to the browser for aperture immediately. p