users@servlet-spec.java.net

[servlet-spec users] Re: Easy UTF-8

From: Yannick Majoros <yannick.majoros_at_gmail.com>
Date: Sun, 30 Aug 2015 21:19:32 +0200

Hi,

Uh, it's always been quite easy. Why do you think it isn't?

You're citing Tomcat, which isn't Java EE btw.

Java itself uses unicode everywhere.

JAX-RS accepts / produces whatever encoding the client requested (I hope
it did request UTF-8 but that's not the spec's problem). It can be
forced to use UTF-8.

You shouldn't have to even care for JSF.

For Servlet, it's up to you. As long as you don't rely on defaults, you
should be fine. JSPs, if you still use them have it quite clear too.

So, that's about it for the web parts of Java EE.

Everytime I've seen someone struggle with this, he used a framework that
made dumb assumptions (Struts anyone? That's not Java EE btw). Or the
developer himself was confused, relied on defaults or converted multiple
times...

I'm curious, what do you want an "encoding" element in web.xml to do?

Cheers,

Yannick


Le 8/30/2015 2:18 PM, Philippe Marschall a écrit :
>
> Hi
>
> UTF-8 is the most popular encoding on the web [1], [2], [3]. However
> configuring a Java EE web application to use UTF-8 has historically
> not been easy or doable in a portable manner [4]. Are there any plans
> to change this, for example by adding a <encoding> element to web.xml?
>
> [1] http://w3techs.com/technologies/overview/character_encoding/all
> [2] http://googleblog.blogspot.ch/2010/01/unicode-nearing-50-of-web.html
> [3] http://www.w3.org/QA/2008/05/utf8-web-growth#c139948
> [4] http://wiki.apache.org/tomcat/FAQ/CharacterEncoding
>
> Cheers
> Philippe