You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Martin Koci <Ma...@aura.cz> on 2007/05/30 13:02:49 UTC

[Trinidad] upload file and UTF-8

Hello,


there is a problem with utf-8 encoding and UploadRequestWrapper in
method setCharacterEncoding. We are using UTF-8 to support Czech
language (and others),  but it doesnt work with file upload - it decodes
request as in iso latin 1.

(Following example can be unreadable in some email clients: test string
"čeština ěěššččřřžžýýááííéé" becomes "eatina aa YY~~�������").


I dont know why but sometimes is encoding "utf-8" and sometimes "UTF-8".

 Then 'if' code :

// If the encoding is already right, we can bail
if (encoding.equals(_encoding))
      return;

will not pass and UploadRequestWrapper will decode request as iso latin1
request.


I fixed it locally with:

// If the encoding is already right, we can bail
if (encoding.equalsIngnoreCase(_encoding))
      return;


but Id don't know where the problem really is.


What do you think?


Regards,


Martin Kočí





Re: [Trinidad] upload file and UTF-8

Posted by Adam Winer <aw...@gmail.com>.
I think equalsIgnoreCase() is quite reasonable here.  I'd
like to know why the case gets passed around differently,
but don't think it's that big of a deal.

-- Adam


On 5/30/07, Martin Koci <Ma...@aura.cz> wrote:
> Hello,
>
>
> there is a problem with utf-8 encoding and UploadRequestWrapper in
> method setCharacterEncoding. We are using UTF-8 to support Czech
> language (and others),  but it doesnt work with file upload - it decodes
> request as in iso latin 1.
>
> (Following example can be unreadable in some email clients: test string
> "čeština ěěššččřřžžýýááííéé" becomes "eatina aa YY~~�������").
>
>
> I dont know why but sometimes is encoding "utf-8" and sometimes "UTF-8".
>
>  Then 'if' code :
>
> // If the encoding is already right, we can bail
> if (encoding.equals(_encoding))
>       return;
>
> will not pass and UploadRequestWrapper will decode request as iso latin1
> request.
>
>
> I fixed it locally with:
>
> // If the encoding is already right, we can bail
> if (encoding.equalsIngnoreCase(_encoding))
>       return;
>
>
> but Id don't know where the problem really is.
>
>
> What do you think?
>
>
> Regards,
>
>
> Martin Kočí
>
>
>
>
>