[opencms-dev] CmsFlexRequest severely broken

Wolfgang Illmeyer wolfgang.illmeyer at gmx.net
Sun Apr 20 20:22:37 CEST 2008


They work by handing over data in x-application/urlencoded format, a form 
field named "text" containig the word "über" is represented by

x=%FCber

With the current state of CmsFlexRequest, I cannot prevent it from decoding 
the POST-body incorrectly without changing the standard encoding to 
ISO8859-1.
In Java, reading a ISO8859-1 bytestream as utf-8 cannot be reversed, because 
the String-constructor replaces the 0xfc "ü"-character by some "I can't 
decode that" character as soon as it sees that it isn't part of a valid utf-8 
sequence, as it is followed by the "b" character. As a matter of fact, it 
even takes away the "b" character.

I am now implementing a Tomcat Valve which calls setCharacterEncoding() on the 
Request before CmsFlexRequest is able to screw it all up. I hope this will 
work.

/Wolfgang

Am Sonntag, 20. April 2008 schrieb Claus Priisholm:
> Assuming that PDF forms work as I expect, what happens is that the form
> is posted as UTF-8, but is incorrectly represented as ISO-8859-1. So you
> have all the correct bytes and it should be safe to get the bytes from
> the request value and turn it into a UTF-8 string without loss of
> information.This method does not rely on any specific tomcat setup, but
> is not as easy to implement (unless your form handling does it for you
> automagically).





More information about the opencms-dev mailing list