You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Richard Sayre <ri...@gmail.com> on 2008/07/03 20:36:17 UTC

Character Encoding and s:textarea

I have a form containing text areas.  When I copy a bunch of character
data such as: 2öÂnJ1ÈÏúÄp8éÎdìåmðh4uæEÍÉieÔWán2ÅìbØÉÅÀ1JÎZÏôsC5LòÚAPúÜaÃÙPC5üÆCJWCOzùÙtÒQqùét

into the text are, it displays normally.  When I save the data, the
database stores the characters properly, when the data returns to the
s:textarea I displays with ?? replacing some characters.

I can't figure out where this is happening.  When I write the data out
to the page as text it all displays properly. When I initially paste
it into the textarea it displays correctly, so my browser supports the
character set (ISO-8859-1 or Latin-1).  It's only when it comes from
the database to the textarea that the characters do not display.  And
I verified that the database can handle the characters and that they
are stored correctly.

This causes a problem when the user saves the second time, the ? get
saved in the db as ?.

Any ideas as to what is happening or how to fix it?

Thank you,

Rich

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


Re: Character Encoding and s:textarea

Posted by Richard Sayre <ri...@gmail.com>.
I found the problem and it does not involve Struts 2.    We changed
our SQL Server 2005 Text columns to varcharmax.  For Java to properly
read the characters out of the DB we had to use rs.getCharacterStream.

Thank you for your help.


On Thu, Jul 3, 2008 at 5:01 PM, Laurie Harper <la...@holoweb.net> wrote:
> Richard Sayre wrote:
>>
>> I have a form containing text areas.  When I copy a bunch of character
>> data such as:
>> 2öÂnJ1ÈÏúÄp8éÎdìåmðh4uæEÍÉieÔWán2ÅìbØÉÅÀ1JÎZÏôsC5LòÚAPúÜaÃÙPC5üÆCJWCOzùÙtÒQqùét
>>
>> into the text are, it displays normally.  When I save the data, the
>> database stores the characters properly, when the data returns to the
>> s:textarea I displays with ?? replacing some characters.
>>
>> I can't figure out where this is happening.  When I write the data out
>> to the page as text it all displays properly. When I initially paste
>> it into the textarea it displays correctly, so my browser supports the
>> character set (ISO-8859-1 or Latin-1).  It's only when it comes from
>> the database to the textarea that the characters do not display.  And
>> I verified that the database can handle the characters and that they
>> are stored correctly.
>>
>> This causes a problem when the user saves the second time, the ? get
>> saved in the db as ?.
>>
>> Any ideas as to what is happening or how to fix it?
>>
>> Thank you,
>>
>> Rich
>
> - Are the characters retrieved from the database correctly? (i.e. if you
> check the data you're sending to the textarea, is it right?)
>
> - What character encoding are you using to serve the page?
>
> - Do you have a @page directive in the JSP specifying the correct character
> encoding?
>
> - Do you have a meta-equiv element in your HTML <head> area to tell the
> browser what encoding the page is in?
>
> - I assume you are using Struts :-) What version?
>
> L.
>
>
> ---------------------------------------------------------------------
> 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: Character Encoding and s:textarea

Posted by Laurie Harper <la...@holoweb.net>.
Richard Sayre wrote:
> I have a form containing text areas.  When I copy a bunch of character
> data such as: 2öÂnJ1ÈÏúÄp8éÎdìåmðh4uæEÍÉieÔWán2ÅìbØÉÅÀ1JÎZÏôsC5LòÚAPúÜaÃÙPC5üÆCJWCOzùÙtÒQqùét
> 
> into the text are, it displays normally.  When I save the data, the
> database stores the characters properly, when the data returns to the
> s:textarea I displays with ?? replacing some characters.
> 
> I can't figure out where this is happening.  When I write the data out
> to the page as text it all displays properly. When I initially paste
> it into the textarea it displays correctly, so my browser supports the
> character set (ISO-8859-1 or Latin-1).  It's only when it comes from
> the database to the textarea that the characters do not display.  And
> I verified that the database can handle the characters and that they
> are stored correctly.
> 
> This causes a problem when the user saves the second time, the ? get
> saved in the db as ?.
> 
> Any ideas as to what is happening or how to fix it?
> 
> Thank you,
> 
> Rich

- Are the characters retrieved from the database correctly? (i.e. if you 
check the data you're sending to the textarea, is it right?)

- What character encoding are you using to serve the page?

- Do you have a @page directive in the JSP specifying the correct 
character encoding?

- Do you have a meta-equiv element in your HTML <head> area to tell the 
browser what encoding the page is in?

- I assume you are using Struts :-) What version?

L.


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