Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
07-02-2013, 07:40 PM #1
- Join Date
- Apr 2007
- Thanked 0 Times in 0 Posts
Display international language characters in JSP
IE 8 and Firefox 21. Tried to display international characters (such as Chinese characters along with the English characters) in a JSP.
I copy a Chinese character and pasted in a input field. It looks as it should be at first. Then I save it to the database (Oracle 11 and set to AL32UTF8 to handle multi-byte characters). Next retrieve the text and display it in a jsp. Now the character becomes the garbage character.
The JSP is set to
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<form id="frm" action="testPage.htm?cmd=loadPage&pageName=home" method="post" enctype="multipart/form-data" acceptCharset="UTF-8">
How to solve the problem?
07-02-2013, 11:20 PM #2
- Join Date
- Mar 2006
- Splendora, Texas, United States of America
- Thanked 299 Times in 293 Posts
If it's not, you should configure your server to output the correct HTTP headers:
Content-Type: text/html; charset=utf-8. HTTP headers are more authoritative than a
metaelement and is the most correct way to specify the character encoding.
If that's not the issue, then I'd imagine you have (A) multiple conflicting
metaelements, (B) your page is being encoded as something other than UTF-8 (declaring that a document is encoded as UTF-8 when it's actually encoded as something else isn't going to help you), or (C) your database is not configured correctly.
For every complex problem, there is an answer that is clear, simple, and wrong.