Entering Non-ASCII Characters as Static Text
This section provides a tutorial example to test how non-ASCII characters entered as static text in JSP pages are converted by JSP server and returned to Web browsers.
Entering non ASCII characters as static HTML text
is much harder than what I initially thought. There are many factors
that should be considered:
- JSP page syntax - Using standard syntax or XML syntax.
- Encoding schema of the JSP page source code.
- Encoding schema of the converted Java source code.
- Encoding schema of the HTTP response.
In order to test out how to control those factors, I picked two simplified
Chinese characters, and entered them in 7 different formats as a simple HTML paragraph:
Hex numbers are provided next to the binary codes, just in case if you have
trouble to copy this file to your local system.
In the next 3 sections, I will put this paragraph into a regular HTML file, a JSP page with
standard syntax, and a JSP page with XML syntax to see how Tomcat server will convert them
into Java class files and in what encodings.
Last update: 2012.
Table of Contents
About This Book
JSP (JavaServer Pages) Overview
Tomcat 7 Installation on Windows Systems
JSP Scripting Elements
Java Servlet Introduction
JSP Implicit Objects
Syntax of JSP Pages and JSP Documents
JSP Application Session
Managing Cookies in JSP Pages
JavaBean Objects and "useBean" Action Elements
Managing HTTP Response Header Lines
►Non-ASCII Characters Support in JSP Pages
Characters Traveling from JSP Files to Browser Screens
Handling ASCII Characters in JSP Pages
Presenting Non ASCII Characters in HTML Documents
Entering Non ASCII Characters in JSP Pages
Java Strings as non-Unicode Encoded Byte Sequences
Java Strings as Unicode Encoded Byte Sequences
►Entering Non-ASCII Characters as Static Text
Static HTML Text in HTML Page
Static HTML Text in JSP Page in Standard Syntax
Static HTML Text in JSP Page in XML Syntax
Supporting Characters in Multiple Languages
Performance of JSP Pages
EL (Expression Language)
Overview of JSTL (JSP Standard Tag Libraries)
JSTL Core Library
JSP Custom Tags
JSP Java Tag Interface
Custom Tag Attributes
Multiple Tags Working Together
File Upload Test Application
PDF Printing Version