[opencms-dev] CmsFlexRequest severely broken

Claus Priisholm cpr at codedroids.com
Sun Apr 20 12:44:56 CEST 2008


You may try to search the mailing list archive, someone posted a 
solution where you tell tomcat to default to UTF-8 rather than ISO-8859-1.
Another workaround is to incl. a hidden field with a character that is 
known to be a multibyte character in UTF-8 (such as "æ").
If the posted field value is mangled it is most likely (haven't seen any 
situation where it was not the case) due to the fact it is wrongly 
encoded. Once that is established, string value form fields can be 
re-encoded.
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).

/Claus

Wolfgang Illmeyer wrote:
> Hi.
> I have a problem with Servlets in OpenCMS 7. For caching, it replaces whatever 
> HttpServletRequest object the Container provides with a "CmsFlexRequest".
> However, CmsFlexRequest breaks the HttpServletRequest design contract by 
> calling the getParameterMap()-function in it's constructor. This effectively 
> breaks 
> <fmt:requestEncoding/>/request.setCharacterEncoding()/getInputStream()/... 
> functionality and makes it impossible for me to correctly retrieve a request 
> from an external resource (I need utf-8 standard charset, but I get a 
> POST-Request from a PDF-File in iso8859-1 format).
> I tried to fiddle around a bit with the source code of CmsFlexRequest to make 
> it stop reading parameters when it MUST NOT, but i only managed to break the 
> opencms login form yet ;)
> Caching isn't needed on a POST Request anyways, is it? Maybe it can be changed 
> to use real HttpServletRequest(Wrapper)s for POST requests on the long run?
> 
> Any idea how I can "quick fix" that problem? Changing the pdf charset to utf-8 
> doesn't seem to be an option, as I don't know any software that can change 
> the charset in an existing pdf form. Also, once the ISO8859-1-Characters are 
> interpreted as UTF-8, there's no way to convert them back without data 
> loss....
> 
> 
> Greetings
> 
> Wolfgang
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.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: 
http://www.codedroids.com/community/opencms




More information about the opencms-dev mailing list