You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pham Anh Tuan <an...@ichi-corp.jp> on 2005/04/15 07:19:34 UTC
[HELP] encodes special characters automatically?
Hi all,
I got a problem, again :)
when I input special characters like japanese or vietnamese character into <html:text>, <html:text> automatically encodes that characters Decimal NCRs before mapping to bean property.
Example 1:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> or <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
<html:text property="myPro"/>
I input japanese characters: わたし
Before it is mapped to bean property myPro: わたし
Example 2:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> or <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
<html:text property="myPro"/>
I input vietnamese characters: Tối Qua
Before it is mapped to bean property myPro: T?i Qua;
So, I wonder that does <html:text> encodes special character automatically when it find some character like japanese or vietnamese?
plz help me!
Pham
Re: [HELP] encodes special characters automatically?
Posted by Pham Anh Tuan <an...@ichi-corp.jp>.
Thank to delbd for ur reply,
I tried to use acceptCharset attribute in <html:form> tag, but MyEclipse
report something like "there's no attribute called acceptCharset for
<html:form>" ?
I only submit a normal form, with text field, not submit for uploading file.
Can you show me in details about ur solution.
thanks
Pham
----- Original Message -----
From: "delbd" <de...@oma.be>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, April 15, 2005 7:48 PM
Subject: Re: [HELP] <html:text> encodes special characters automatically?
>I assume you mean you input japanese character but the form bean gets a
>messed
> result. If you have a multi-part/formdata encoding for form (used for file
> uploads) keep in ming there are problem detecting at the character
> encoding
> used by submitter. Browser is supposed to send the data in the same
> encoding
> as web page, but fileupload utility seems to be unable to catch the
> encoding
> used by web browser and the form validation bean get datas as if entered
> using iso-8859-1 (which is problematic when the web browser did in fact
> send
> an utf-8 stream).
>
> To soluce this, we always put this in multi part forms:
> <html:form action="/someAction.do" enctype="multipart/form-data"
> acceptCharset="ISO-8859-1">
>
> This way we are sure the encoding used by borwser is the same as the one
> fileupload tool defaults to.
>
> Le Vendredi 15 Avril 2005 07:19, Pham Anh Tuan a écrit :
>> Hi all,
>>
>> I got a problem, again :)
>>
>> when I input special characters like japanese or vietnamese character
>> into
>> <html:text>, <html:text> automatically encodes that characters Decimal
>> NCRs
>> before mapping to bean property.
>>
>> Example 1:
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>> or
>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ...
>> <html:text property="myPro"/>
>> I input japanese characters: わたし
>> Before it is mapped to bean property myPro: わたし
>>
>> Example 2:
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>> or
>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ...
>> <html:text property="myPro"/>
>> I input vietnamese characters: Tối Qua
>> Before it is mapped to bean property myPro: T?i Qua;
>>
>> So, I wonder that does <html:text> encodes special character
>> automatically
>> when it find some character like japanese or vietnamese?
>>
>> plz help me!
>>
>> Pham
>
> --
> David Delbecq
> Royal Meteorological Institute of Belgium
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [HELP] encodes special characters automatically?
Posted by delbd <de...@oma.be>.
I assume you mean you input japanese character but the form bean gets a messed
result. If you have a multi-part/formdata encoding for form (used for file
uploads) keep in ming there are problem detecting at the character encoding
used by submitter. Browser is supposed to send the data in the same encoding
as web page, but fileupload utility seems to be unable to catch the encoding
used by web browser and the form validation bean get datas as if entered
using iso-8859-1 (which is problematic when the web browser did in fact send
an utf-8 stream).
To soluce this, we always put this in multi part forms:
<html:form action="/someAction.do" enctype="multipart/form-data"
acceptCharset="ISO-8859-1">
This way we are sure the encoding used by borwser is the same as the one
fileupload tool defaults to.
Le Vendredi 15 Avril 2005 07:19, Pham Anh Tuan a écrit :
> Hi all,
>
> I got a problem, again :)
>
> when I input special characters like japanese or vietnamese character into
> <html:text>, <html:text> automatically encodes that characters Decimal NCRs
> before mapping to bean property.
>
> Example 1:
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> or
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ...
> <html:text property="myPro"/>
> I input japanese characters: わたし
> Before it is mapped to bean property myPro: わたし
>
> Example 2:
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> or
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ...
> <html:text property="myPro"/>
> I input vietnamese characters: Tối Qua
> Before it is mapped to bean property myPro: T?i Qua;
>
> So, I wonder that does <html:text> encodes special character automatically
> when it find some character like japanese or vietnamese?
>
> plz help me!
>
> Pham
--
David Delbecq
Royal Meteorological Institute of Belgium
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [HELP] encodes special characters automatically?
Posted by Pham Anh Tuan <an...@ichi-corp.jp>.
but .... there's no Filter attribute in <html:text> :|
----- Original Message -----
From: "yue pengfei" <yu...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, April 15, 2005 3:33 PM
Subject: Re: [HELP] <html:text> encodes special characters automatically?
> Maybe you need set the filter attribute of html:text
>
> On 4/15/05, Pham Anh Tuan <an...@ichi-corp.jp> wrote:
>> Hi all,
>>
>> I got a problem, again :)
>>
>> when I input special characters like japanese or vietnamese character
>> into <html:text>, <html:text> automatically encodes that characters
>> Decimal NCRs before mapping to bean property.
>>
>> Example 1:
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>> or <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>> ...
>> <html:text property="myPro"/>
>> I input japanese characters: わたし
>> Before it is mapped to bean property myPro: わたし
>>
>> Example 2:
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>> or <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>> ...
>> <html:text property="myPro"/>
>> I input vietnamese characters: Tối Qua
>> Before it is mapped to bean property myPro: T?i Qua;
>>
>> So, I wonder that does <html:text> encodes special character
>> automatically when it find some character like japanese or vietnamese?
>>
>> plz help me!
>>
>> Pham
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [HELP] encodes special characters automatically?
Posted by yue pengfei <yu...@gmail.com>.
Maybe you need set the filter attribute of html:text
On 4/15/05, Pham Anh Tuan <an...@ichi-corp.jp> wrote:
> Hi all,
>
> I got a problem, again :)
>
> when I input special characters like japanese or vietnamese character into <html:text>, <html:text> automatically encodes that characters Decimal NCRs before mapping to bean property.
>
> Example 1:
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> or <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> ...
> <html:text property="myPro"/>
> I input japanese characters: わたし
> Before it is mapped to bean property myPro: わたし
>
> Example 2:
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> or <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> ...
> <html:text property="myPro"/>
> I input vietnamese characters: Tối Qua
> Before it is mapped to bean property myPro: T?i Qua;
>
> So, I wonder that does <html:text> encodes special character automatically when it find some character like japanese or vietnamese?
>
> plz help me!
>
> Pham
>