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/20 04:15:44 UTC

[AGAIN, PLZ HELP] Experiences using Struts with Japanese?

This is the second times I post this topic, I'm in stuck of Struts with Japanese. I use <html:text> to input and show Japanese characters and save them to mySQL (set charset sjis). The jsp page which contains <html:text> above, I set charset is sjis. If everything does right, japanese character will be saved in mySQL, and I could show them in <html:text> Struts tag. But everything doesn't happen like that, I can input japanese characters in <html:text>, saving them to mySQL, but in mySQL, them saved like Decimal NCRs, some thing like &#12431 for each character, it's not 2 bytes character like mySQL spec said if I set my database's charset is sjis in mySQL but it's 4 bytes characters (may be Struts <html:text> encodes automatically Japanese character to decimal characters before Saving To Database Action happens ?). So when I get Japanese characters from mySQL to show on JSP by <html:text>, I only see decimal characters.

So, plz help me and show me the way to save & show special characters like Japanese or Vietnamese to mySQL with Struts.

thanks for reading!

Pham

Re: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?

Posted by Jason Lea <ja...@kumachan.net.nz>.
Good to hear :)

getting all the character encoding stuff working right can be a bit tricky

Pham Anh Tuan wrote:

>Thank you very much, Jason, my work is completed with ur help :)
>
>Pham
>----- Original Message ----- 
>From: "Pham Anh Tuan" <an...@ichi-corp.jp>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Sent: Wednesday, April 20, 2005 10:00 AM
>Subject: Re: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?
>
>
>  
>
>>Thank you, Jason Lea, I'm very happy when I receive ur feedback!
>>
>>I will read it, and post reply to all you about my problem after I do 
>>follow the instructions.
>>
>>thank you
>>
>>Pham
>>----- Original Message ----- 
>>From: "Jason Lea" <ja...@kumachan.net.nz>
>>To: "Struts Users Mailing List" <us...@struts.apache.org>
>>Sent: Wednesday, April 20, 2005 9:35 AM
>>Subject: Re: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?
>>
>>
>>    
>>
>>>I setup my database to use Unicode, which is what Java uses.  Then it is 
>>>easier to either display the characters as UTF-8 on a webpage (so 
>>>japanese/french/vietnamese etc can be shown).  You can change to other 
>>>encodings on the web page eg SJIS.
>>>
>>>I think you have several character set translation problems occuring. 
>>>The web page may be submitting the information in SJIS format, but struts 
>>>might be reading them in the default Latin-1 encoding (i forget the iso 
>>>number for it).  Then java treating the values as Unicode stores those 
>>>values in MySql, not in SJIS format.  Reading these values out of the 
>>>database, they are already incorrect and so they display incorrectly.
>>>
>>>You can put a filter in front of struts to force it to use the correct 
>>>character encoding, and storing the information in Unicode in the 
>>>database would simplify your problems.
>>>
>>>I am trying to find a link that had a good explaination of the steps. 
>>>The web page has disappeared but can be viewed here:
>>>
>>>http://web.archive.org/web/20040619054137/http://www.anassina.com/struts/i18n/i18n.html
>>>
>>>
>>>Pham Anh Tuan wrote:
>>>
>>>      
>>>
>>>>This is the second times I post this topic, I'm in stuck of Struts with 
>>>>Japanese. I use <html:text> to input and show Japanese characters and 
>>>>save them to mySQL (set charset sjis). The jsp page which contains 
>>>><html:text> above, I set charset is sjis. If everything does right, 
>>>>japanese character will be saved in mySQL, and I could show them in 
>>>><html:text> Struts tag. But everything doesn't happen like that, I can 
>>>>input japanese characters in <html:text>, saving them to mySQL, but in 
>>>>mySQL, them saved like Decimal NCRs, some thing like &#12431 for each 
>>>>character, it's not 2 bytes character like mySQL spec said if I set my 
>>>>database's charset is sjis in mySQL but it's 4 bytes characters (may be 
>>>>Struts <html:text> encodes automatically Japanese character to decimal 
>>>>characters before Saving To Database Action happens ?). So when I get 
>>>>Japanese characters from mySQL to show on JSP by <html:text>, I only see 
>>>>decimal characters.
>>>>
>>>>So, plz help me and show me the way to save & show special characters 
>>>>like Japanese or Vietnamese to mySQL with Struts.
>>>>
>>>>thanks for reading!
>>>>
>>>>Pham
>>>>
>>>>        
>>>>
>>>-- 
>>>Jason Lea
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>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
>>
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

-- 
Jason Lea



Re: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?

Posted by Pham Anh Tuan <an...@ichi-corp.jp>.
Thank you very much, Jason, my work is completed with ur help :)

Pham
----- Original Message ----- 
From: "Pham Anh Tuan" <an...@ichi-corp.jp>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, April 20, 2005 10:00 AM
Subject: Re: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?


> Thank you, Jason Lea, I'm very happy when I receive ur feedback!
>
> I will read it, and post reply to all you about my problem after I do 
> follow the instructions.
>
> thank you
>
> Pham
> ----- Original Message ----- 
> From: "Jason Lea" <ja...@kumachan.net.nz>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Wednesday, April 20, 2005 9:35 AM
> Subject: Re: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?
>
>
>>I setup my database to use Unicode, which is what Java uses.  Then it is 
>>easier to either display the characters as UTF-8 on a webpage (so 
>>japanese/french/vietnamese etc can be shown).  You can change to other 
>>encodings on the web page eg SJIS.
>>
>> I think you have several character set translation problems occuring. 
>> The web page may be submitting the information in SJIS format, but struts 
>> might be reading them in the default Latin-1 encoding (i forget the iso 
>> number for it).  Then java treating the values as Unicode stores those 
>> values in MySql, not in SJIS format.  Reading these values out of the 
>> database, they are already incorrect and so they display incorrectly.
>>
>> You can put a filter in front of struts to force it to use the correct 
>> character encoding, and storing the information in Unicode in the 
>> database would simplify your problems.
>>
>> I am trying to find a link that had a good explaination of the steps. 
>> The web page has disappeared but can be viewed here:
>>
>> http://web.archive.org/web/20040619054137/http://www.anassina.com/struts/i18n/i18n.html
>>
>>
>> Pham Anh Tuan wrote:
>>
>>>This is the second times I post this topic, I'm in stuck of Struts with 
>>>Japanese. I use <html:text> to input and show Japanese characters and 
>>>save them to mySQL (set charset sjis). The jsp page which contains 
>>><html:text> above, I set charset is sjis. If everything does right, 
>>>japanese character will be saved in mySQL, and I could show them in 
>>><html:text> Struts tag. But everything doesn't happen like that, I can 
>>>input japanese characters in <html:text>, saving them to mySQL, but in 
>>>mySQL, them saved like Decimal NCRs, some thing like &#12431 for each 
>>>character, it's not 2 bytes character like mySQL spec said if I set my 
>>>database's charset is sjis in mySQL but it's 4 bytes characters (may be 
>>>Struts <html:text> encodes automatically Japanese character to decimal 
>>>characters before Saving To Database Action happens ?). So when I get 
>>>Japanese characters from mySQL to show on JSP by <html:text>, I only see 
>>>decimal characters.
>>>
>>>So, plz help me and show me the way to save & show special characters 
>>>like Japanese or Vietnamese to mySQL with Struts.
>>>
>>>thanks for reading!
>>>
>>>Pham
>>>
>>
>> -- 
>> Jason Lea
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?

Posted by Pham Anh Tuan <an...@ichi-corp.jp>.
Thank you, Jason Lea, I'm very happy when I receive ur feedback!

I will read it, and post reply to all you about my problem after I do follow 
the instructions.

thank you

Pham
----- Original Message ----- 
From: "Jason Lea" <ja...@kumachan.net.nz>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, April 20, 2005 9:35 AM
Subject: Re: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?


>I setup my database to use Unicode, which is what Java uses.  Then it is 
>easier to either display the characters as UTF-8 on a webpage (so 
>japanese/french/vietnamese etc can be shown).  You can change to other 
>encodings on the web page eg SJIS.
>
> I think you have several character set translation problems occuring.  The 
> web page may be submitting the information in SJIS format, but struts 
> might be reading them in the default Latin-1 encoding (i forget the iso 
> number for it).  Then java treating the values as Unicode stores those 
> values in MySql, not in SJIS format.  Reading these values out of the 
> database, they are already incorrect and so they display incorrectly.
>
> You can put a filter in front of struts to force it to use the correct 
> character encoding, and storing the information in Unicode in the database 
> would simplify your problems.
>
> I am trying to find a link that had a good explaination of the steps.  The 
> web page has disappeared but can be viewed here:
>
> http://web.archive.org/web/20040619054137/http://www.anassina.com/struts/i18n/i18n.html
>
>
> Pham Anh Tuan wrote:
>
>>This is the second times I post this topic, I'm in stuck of Struts with 
>>Japanese. I use <html:text> to input and show Japanese characters and save 
>>them to mySQL (set charset sjis). The jsp page which contains <html:text> 
>>above, I set charset is sjis. If everything does right, japanese character 
>>will be saved in mySQL, and I could show them in <html:text> Struts tag. 
>>But everything doesn't happen like that, I can input japanese characters 
>>in <html:text>, saving them to mySQL, but in mySQL, them saved like 
>>Decimal NCRs, some thing like &#12431 for each character, it's not 2 bytes 
>>character like mySQL spec said if I set my database's charset is sjis in 
>>mySQL but it's 4 bytes characters (may be Struts <html:text> encodes 
>>automatically Japanese character to decimal characters before Saving To 
>>Database Action happens ?). So when I get Japanese characters from mySQL 
>>to show on JSP by <html:text>, I only see decimal characters.
>>
>>So, plz help me and show me the way to save & show special characters like 
>>Japanese or Vietnamese to mySQL with Struts.
>>
>>thanks for reading!
>>
>>Pham
>>
>
> -- 
> Jason Lea
>
>
>
>
> ---------------------------------------------------------------------
> 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: [AGAIN, PLZ HELP] Experiences using Struts with Japanese?

Posted by Jason Lea <ja...@kumachan.net.nz>.
I setup my database to use Unicode, which is what Java uses.  Then it is 
easier to either display the characters as UTF-8 on a webpage (so 
japanese/french/vietnamese etc can be shown).  You can change to other 
encodings on the web page eg SJIS.

I think you have several character set translation problems occuring.  
The web page may be submitting the information in SJIS format, but 
struts might be reading them in the default Latin-1 encoding (i forget 
the iso number for it).  Then java treating the values as Unicode stores 
those values in MySql, not in SJIS format.  Reading these values out of 
the database, they are already incorrect and so they display incorrectly.

You can put a filter in front of struts to force it to use the correct 
character encoding, and storing the information in Unicode in the 
database would simplify your problems.

I am trying to find a link that had a good explaination of the steps.  
The web page has disappeared but can be viewed here:

http://web.archive.org/web/20040619054137/http://www.anassina.com/struts/i18n/i18n.html


Pham Anh Tuan wrote:

>This is the second times I post this topic, I'm in stuck of Struts with Japanese. I use <html:text> to input and show Japanese characters and save them to mySQL (set charset sjis). The jsp page which contains <html:text> above, I set charset is sjis. If everything does right, japanese character will be saved in mySQL, and I could show them in <html:text> Struts tag. But everything doesn't happen like that, I can input japanese characters in <html:text>, saving them to mySQL, but in mySQL, them saved like Decimal NCRs, some thing like &#12431 for each character, it's not 2 bytes character like mySQL spec said if I set my database's charset is sjis in mySQL but it's 4 bytes characters (may be Struts <html:text> encodes automatically Japanese character to decimal characters before Saving To Database Action happens ?). So when I get Japanese characters from mySQL to show on JSP by <html:text>, I only see decimal characters.
>
>So, plz help me and show me the way to save & show special characters like Japanese or Vietnamese to mySQL with Struts.
>
>thanks for reading!
>
>Pham
>  
>

-- 
Jason Lea




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org