[opencms-dev] Recommend page encoding problem

Claus Priisholm cpr at codedroids.com
Mon Oct 3 09:31:05 CEST 2005

It seems that when accessing the site 'outside' the workplace, that 
something triggers Tomcat to assume request encoding to be iso-8859-1. 
(could be a call to request.getParameter() before the encoding is set to 

And of course behaviour differs from browser to browser (and just before 
I checked in to the asylum it also seemed to make a difference whether 
you POST or GET)...

Anyway, a so far bulletproof hack is to pass along a hidden field with a 
character that is known to be a multibyte character in UTF-8 - you can 
then check it in the request whether it has been mangled or not, and 
make the necessary re-encoding.


Alessandro La Rocca wrote:
> Hi,
> I have problems with the encoding of the message inside the recommend 
> form with characters like àéèì...
> If I try inserting just "à", from the cms preview (offline) it works as 
> expected (well encoded, getBytes returns 2). While from the online it 
> returns a bad encoded string (getBytes returns 4!!!).
> More information:
> - for the rest, encoding works as expected (arabic too)
> - template are the same in offline and online
> - response.getEncoding returns always UTF-8
> - my environment: Linux CentOS 4, Apache Web Server, JK Connector 
> 1.2.10, Tomcat 5.0.28, JDK 1.5.0_03
> Any suggestion will make me spend a great weekend. Regards, Alessandro
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev

Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
Javadocs and other OpenCms stuff: 

More information about the opencms-dev mailing list