Thanks again !<br><br><div class="gmail_quote">On Mon, 15 Dec 2014 00:06 Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have created <a href="https://issues.jboss.org/browse/UNDERTOW-356" target="_blank">https://issues.jboss.org/<u></u>browse/UNDERTOW-356</a>, I will probably get to it some time this week.<br>
<br>
BTW the reason why it defaults to ISO-8859-1 is because this is what the HTTP RFC says is the default, however it appears that in practice often browsers don&#39;t know the charset.<br>
<br>
Stuart<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Laurent Bedubourg&quot; &lt;<a href="mailto:lbedubourg@gmail.com" target="_blank">lbedubourg@gmail.com</a>&gt;<br>
&gt; To: <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
&gt; Sent: Saturday, 13 December, 2014 8:54:40 PM<br>
&gt; Subject: [undertow-dev] UTF8 form parsing<br>
&gt;<br>
&gt; Hello,<br>
&gt;<br>
&gt; I am using utf-8 as default encoding for the web and it didn&#39;t worked out of<br>
&gt; the box with Undertow and EagerFormParsingHandler.<br>
&gt;<br>
&gt; It turned out that MultiPartParserDefinition has a default iso-8859-1<br>
&gt; encoding and that it&#39;s quite hard to change it. You have to create a custom<br>
&gt; FormParserFactory containing a MultiPartParserDefinition with the right<br>
&gt; setDefaultEncoding() that&#39;s a lot of work for something that common and I<br>
&gt; had to spend half an hour looking at Undertow sources to understand how it<br>
&gt; work and why my input was garbage.<br>
&gt;<br>
&gt; The assumption that Browsers will add a &quot;; charset=UTF-8&quot; to the Content type<br>
&gt; is false (at least with google chrome).<br>
&gt;<br>
&gt; My temporary hack is to override EagerFormParsingHandler and modify the<br>
&gt; request CONTENT_TYPE header to add the UTF-8 charset and then setNext my<br>
&gt; real HttpHandler (I had less mental friction doing this than learning how to<br>
&gt; create my custom FormParserFactor).<br>
&gt;<br>
&gt; new EagerFormParsingHandler(){<br>
&gt; override def handleRequest(x:<u></u>HttpServerExchange){<br>
&gt; val ct = x.getRequestHeaders().get(<u></u>Headers.CONTENT_TYPE).getLast(<u></u>)<br>
&gt; x.getRequestHeaders().put(<u></u>Headers.CONTENT_TYPE, ct+&quot;; charset=UTF-8&quot;)<br>
&gt; super.handleRequest(x)<br>
&gt; }<br>
&gt; }.setNext(new HttpHandler(){<br>
&gt; def handleRequest(x:<u></u>HttpServerExchange){ ... }<br>
&gt; })<br>
&gt;<br>
&gt; Now that I know it I can create my own Utf8FormParsingHandler but I imagine<br>
&gt; that other users will want to be able to define the encoding out of the box.<br>
&gt;<br>
&gt; Maybe with a new self documenting contructor like :<br>
&gt;<br>
&gt; new EagerFormParsingHandler(<u></u>encoding:String, nextHandler:HttpHandler)<br>
&gt;<br>
&gt; Best regards<br>
&gt; Laurent<br>
&gt;<br>
&gt; ______________________________<u></u>_________________<br>
&gt; undertow-dev mailing list<br>
&gt; <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a><br>
</blockquote></div>