[opencms-dev] Encoding problem when form type is multipart/form-data

Sven Bonorden bonorden at getit.de
Fri Jul 30 16:08:02 CEST 2004


Ivan,

we had the same problem in OpenCms 5.0.1.
Request parameter values from multipart forms were always encoded in 
ISO-8859-1 independent of the settings in Jsp, Cms or Java (which were 
all UTF-8 for us).
We could solve the problem by reencoding the getParameter results from 
ISO-8859-1 to UTF-8 but I don't know if that also works for Cyrillic chars.

Sven


Ivan Jelenic wrote:

> Hi,
> We are using a small form for uploading files with one text filed:
> <form name="send" method="post" action="some.jsp" 
> enctype="multipart/form-data">
> <br>
> <textarea cols="80" rows="30" name="content">
> Type your text here.
> </textarea>
> <br><br>
> <input type=file name=attachment>
> <br><br>
> <input type=Submit value=Send>
>
> </form>
> Jsp page with this form has a content-encoding property set to UTF-8 
> and jsp page specified in action, too. When I want to get text from 
> textarea I use this piece of code:
> CmsJspActionElement cms = new CmsJspActionElement(pageContext, 
> request, response);
> String content = 
> cms.getRequestContext().getRequest().getParameter("content");
> My problem is that I don't have UTF-8 characters in String variable 
> content. With uploaded file everything is fine. I try to 
> setCharacterEncoding("UTF-8") on request object before initialize 
> CmsJspActionElement but there was no results. So, when I send some 
> Cyrillic's content with file I've got something like this: 
> дфхгфдхгфдхгфд.
> We use OpenCms5.0.0 (set to UTF-8), WinXP, MySql 4.0.15, Tomcat 
> 4.1.24LE (with -Dfile.encoding=UTF-8) and JDK 1.4.2_03.
> Please, help.
> Best regards,
> Ivan Jelenic
> ivan.jelenic at nbs.yu <mailto:ivan.jelenic at nbs.yu>






More information about the opencms-dev mailing list