You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nathan Coast <na...@codeczar.com> on 2006/10/02 22:42:59 UTC

utf-8 a strange problem

Hi,

utf-8 seems to be working fine in my apps for internationalised 
messages, unfortunately it seems to break whenever I use 
<bean:write.....  or <html:text.....

In other words, if I'm attempting to render 'Aşterge' from a resource 
bundle using <bean:message it works fine.  However, if the same text is 
a property of a bean and I attempt to render it using <bean:write or 
<html:text it is rendered as 'A&#351;terge'

Interestingly, if I set <bean:write filter="false" it renders correctly. 
  However, I need the filter functionality.  Also this is not available 
in  <html:text...

I had a look at the difference between bean:message, bean:write and 
html:text and it seems that bean:write and html:text both use a 
StringBuffer instance to assemble the String before writing to the 
JspWriter.   For bean:write if filter="false" then no StringBuffer used. 
  Could the internals of StringBuffer be messing with Strings?

All of the usual goodies are set up correctly for UTF-8 as documented 
here:  http://tomcat.apache.org/faq/misc.html#utf8 .   My browser is 
reporting that all pages are UTF-8.

any suggestions greatly appreciated,

cheers
Nathan


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


Re: utf-8 a strange problem

Posted by Nathan Coast <na...@codeczar.com>.
fixed,

well, nothing to fix actually,  some of the text had got into the db 
containing escape sequences e.g.  A&#351;terge

so with bean:write filter="false" A&#351;terge was written to html as is 
and the browser rendered as Aşterge

however with filter="true" A&#351;terge was written to html as 
A&amp;#351;terge and the browser rendered as A&#351;terge


Nathan Coast wrote:
> Hi,
> 
> utf-8 seems to be working fine in my apps for internationalised 
> messages, unfortunately it seems to break whenever I use 
> <bean:write.....  or <html:text.....
> 
> In other words, if I'm attempting to render 'Aşterge' from a resource 
> bundle using <bean:message it works fine.  However, if the same text is 
> a property of a bean and I attempt to render it using <bean:write or 
> <html:text it is rendered as 'A&#351;terge'
> 
> Interestingly, if I set <bean:write filter="false" it renders correctly. 
>  However, I need the filter functionality.  Also this is not available 
> in  <html:text...
> 
> I had a look at the difference between bean:message, bean:write and 
> html:text and it seems that bean:write and html:text both use a 
> StringBuffer instance to assemble the String before writing to the 
> JspWriter.   For bean:write if filter="false" then no StringBuffer used. 
>  Could the internals of StringBuffer be messing with Strings?
> 
> All of the usual goodies are set up correctly for UTF-8 as documented 
> here:  http://tomcat.apache.org/faq/misc.html#utf8 .   My browser is 
> reporting that all pages are UTF-8.
> 
> any suggestions greatly appreciated,
> 
> cheers
> Nathan
> 
> 
> ---------------------------------------------------------------------
> 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