• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP and UTF-8

 
Christian Donner
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to display a Euro symbol on a JSP page and can't figure out why none of the three variations below works. I am running Solaris 8 and iPlanet AppServer 6 SP3. I have tried to both Solaris locales, ISO-8859-1 and UTF-8 without a difference.
Thanks,
c.

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page language="java" %>
<HTML>
<BODY>
<%
char cEuro = '\u20AC';
String sEuro = new String("�");
byte[] bEuro = {(byte)0xE2, (byte)0x82, (byte)0xAC};
String sEuro2 = new String(bEuro, "UTF-8");
out.print("String: "+sEuro+" <BR>");
out.print("Char: "+cEuro+" <BR>");
out.print("Bytestream: "+sEuro2+" <BR>");
%>
</BODY>
</HTML>
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if you found your answer, but
http://java.sun.com/docs/books/tutorial/i18n/text/stream.html
explains your question well I thought
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!