J
Jeff
I'd like to be able to render chinese characters from a UTF-8 database
and I'd like to be able to render them from inside the JSP. When I print
ASCII strings of unicode characters with this page directive:
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="Cp1252" %>
The unicode strings of chinese characters print fine, but the data from
the database does not.
If I switch to this page directive:
<%@ page pageEncoding="UTF-8" %>
And try to convert the unicode strings to UTF-8, I get a series of
question marks ?????
java.util.Properties p = new java.util.Properties();
p.setProperty("userName", "\u660e\u67b6\u5e73\u677f");
byte[] utfBytes = p.getProperty("userName").getBytes("UTF8");
String utfString = new String(utfBytes, "UTF8");
<%=utfString%> <- prints ????
TIA,
Jeff
and I'd like to be able to render them from inside the JSP. When I print
ASCII strings of unicode characters with this page directive:
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="Cp1252" %>
The unicode strings of chinese characters print fine, but the data from
the database does not.
If I switch to this page directive:
<%@ page pageEncoding="UTF-8" %>
And try to convert the unicode strings to UTF-8, I get a series of
question marks ?????
java.util.Properties p = new java.util.Properties();
p.setProperty("userName", "\u660e\u67b6\u5e73\u677f");
byte[] utfBytes = p.getProperty("userName").getBytes("UTF8");
String utfString = new String(utfBytes, "UTF8");
<%=utfString%> <- prints ????
TIA,
Jeff