Non-ASCII Characters Support in JSP Pages
This chapter provides tutorial notes and example codes on non-ASCII characters support in JSP pages. Topics include processing steps of text in JSP pages; entering non-ASCII characters as Java Strings and as static text; entering non-ASCII characters in Unicode UTF-8 encoding.
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
As you can see from my notes in the previous sections, localizing or
internationalizing JSP pages is not an easy task. My recommendations are:
- Avoid using static text. Put the entire page under a scriptlet, so all text
messages are generated from Java statements.
- Using Unicode codes in UTF-8 format or \uHEX format for string literals.
It allows us to support characters in all local languages in a single encoding.
- Use UTF-8 as the HTML document encoding instead of encodings of a particular
local language, like GB2312. This may cause problems for users on locale systems
where Unicode fonts are not supported. But more and more locale systems are supporting
Unicode and UTF-8 encoding.
- I still don't know how to control the source code encoding of JSP pages in XML syntax.
For more notes on non ASCII codes and Java program localization, see my other books:
"Unicode Tutorials - Herong's Tutorial Examples" and "JDK Tutorials - Herong's Tutorial Examples".
Table of Contents
About This Book
JSP (JavaServer Pages) Overview
Tomcat 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
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
Using Tomcat on CentOS Systems
Using Tomcat on macOS Systems
Connecting to SQL Server from Servlet
Developing Web Applications with Servlet
Full Version in PDF/EPUB