https://bz.apache.org/bugzilla/show_bug.cgi?id=63985

--- Comment #3 from Christopher Schultz <ch...@christopherschultz.net> ---
(In reply to Hubert Gailly from comment #2)
> Same text is saved in UTF8 in 2 separate files one with BOM, one without BOM.
> All the declared as UTF-8.
> In Apache 'httpd.conf' : AddDefaultCharset UTF-8

So Apache httpd is also in the mix? Great. More opportunities for things to go
wrong with the character set.

> In tomcat 'server.xml' :
> <Connector port="8009" enableLookups="false" redirectPort="8443"
> protocol="AJP/1.3" URIEncoding="UTF-8"/>

This setting (URIEncoding) has nothing to do with the character set used to
encode a response.

> In the file itself : <META
> content="text/html; charset=utf-8" http-equiv=Content-Type>

I'm not sure if that needs to be quoted, but I would definitely quote it. It
doesn't matter, as the response header Content-Type will override whatever the
<meta/> tag says.

> I tried all different configurations :
> In both application and tomcat 'web.xml'
> <init-param>
>             <param-name>fileEcoding</param-name>
>             <param-value>UTF8</param-value> 
> </init-param> 
> Or 
> <init-param>
>             <param-name>fileEcoding</param-name>
>             <param-value>UTF-8</param-value> 
> </init-param> 

Which filter is this? CharacterSetEncodingFilter? If so, you have not
configured it correctly, which is probably why it's not working.
http://tomcat.apache.org/tomcat-9.0-doc/config/filter.html#Add_Default_Character_Set_Filter

The init-param is spelled "encoding", not "fileEncoding" or "fileEcoding".

> And/Or 
> Starting Tomcat 9 with
> -Dfile.encoding=UT8
> Or
> -Dfile.encoding=UTF-8

These don't matter, either.

> If served by Tomcat the file with no BOM is corrupted. Accents are rubbish
> characters.
> I save the file as ISO-8859-1, it is correct.
> 
> That means that whatever I say to Tomcat9, if there is a UTF8 static file,
> Tomcat9 always reads it as a ISO-8859-1, thus breaking the characters.

Tomcat is not "reading" anything at all. It's taking bytes from the disk and
placing them on the wire. It's the client which is interpreting the bytes as
ISO-8859-1.

> There is no problem with the file with BOM.

Again, this is down to client behavior. Please move this discussion to the
users' list.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to