users@glassfish.java.net

Re: character encoding

From: <glassfish_at_javadesktop.org>
Date: Sun, 09 May 2010 19:14:21 PDT

Hallo!
I have followed your instructions now to the point, and i have to say thank you very much for this!!!

I have solved my problem now, at least so i thought because it all works fine now. Then i noticed that Firefox plays tricks with me. Safari in my MAC, Internet Explorer in Windows works fine. But Firefox both on a MAC and in Windows gives me trouble with the UTF-8 encoding somehow. It only displays iso-8859-1 when you look so the page looks like shit both in Swedish and Russian due to this.


1. I have check my XML, JSP and TEXT files, HTML files i do not have in my project and they look like this;

<?xml version="1.0" encoding="UTF-8"?>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<%_at_page contentType="text/html; Charset=UTF-8" language="java"%>

So it is only the JSP file that looks different here then yours. Is mine wrong or would it work anyhow, please let me know? Your are below here.

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>


2. Above my header i have this for the JSP files;

<%_at_page import="com.neptunediving.*"%>
<%_at_include file="WEB-INF/include/LangSupport.jsp"%>
<%_at_page contentType="text/html; Charset=UTF-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang="en" lang="en">

Is there anything wrong with this one or not?

Further down in the header i have this;

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

and i hope all this is right for this, if not please let me know.


3. Now to the big thing that i have found out with my site. To see this better i have attached a screen shot of my project in eclipse, part 1 and 2 for you to have a look at.

I have changed all my files from iso-8859-1 to UTF-8 like you have said. I have also followed your instructions above here as well but still i have a problem in Firefox who displays it all in iso-8859-1 instead of UTF-8.

In my WEB-INF folder i have a folder with all my files i make an include of, see the files in the screen shoots. These are files like my header, footer and all my menus. There are also a few other files like LangSupport, google, freefind and showtime. I have changed all these ones into UTF-8 under respective properties file.

I read somewhere on the internet where somebody said that you need to put what charset you are using in all files. Do i really need to put,
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
or
<%_at_page contentType="text/html; Charset=UTF-8" language="java"%>
or both of them in these files as well to get this to work?

If so do i need to make a header and body under each one so the meta tag works,
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
And the rest of the text i use in these files? or how does this work? There are no real header or body tags in these files since they only are includes for my menu and some other stuff.

Footer i have changed the encoding since eclipse wants me to do this but in the rest i have not. Files like LangSupport, google, freefind and showtime are more or less only code so should i need to put this in there as well?
[Message sent by forum member 'torleif67']

http://forums.java.net/jive/thread.jspa?messageID=469133