struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonny Cavell <jonny.cav...@gmail.com>
Subject Re: [s2] How do I output unicode characters please help
Date Wed, 19 Dec 2007 10:39:24 GMT

I am also having difficulty with using Struts2 and Freemarker.

I am setting default_encoding=UTF-8 in freemarker.properties, and leaving
the struts encoding in default.properties untouched (i.e.
struts.i18n.encoding=UTF-8). When I use a struts action to forward to a test
page with Spanish text, without specifying the type (thus defaulting to
jsp), it outputs fine. However, if the action forwards to the same page, but
specifying the type as freemarker, the output is garbled.

Even if I subclass FreemarkerManager, override the createConfiguration
method and explicitly call config.setDefaultEncoding("utf-8") here, and
specify this class as the struts.freemarker.manager.classname in
struts.properties, it makes no difference - the output is garbled.

Does anybody know why this might be the case? 

Thanks

Jonny



Laurie Harper wrote:
> 
> Er, no; property files are required to be in ASCII format. Using a UTF-8 
> character encoding in a properties file will not work.
> 
> @Dave: &#xFC; is a valid encoding of the character \u00fc, it's 
> equivalent; in fact, I think it's equivalent regardless of character 
> encoding for the served HTML, which would make it the most portable 
> representation. Why do you want something else?
> 
> If you really can't work with the encoded output, you may be able to get 
> the raw character, for example with <s:property value="test" 
> escape="false"/>.
> 
> L.
> 
> Leonidas Papadakis wrote:
>> Just put the umlaut character u" directly to your property file and make 
>> sure that you save it as utf-8 not ansi e.t.c.
>> 
>> Regards,
>> 
>> Leon
>> 
>> David Harland wrote:
>>> Hi,
>>>
>>> Thanks I have added those properties but it is still outputting &#xFC;.
>>>
>>> Can someone please tell me what I might be doing wrong.
>>>
>>> Dave.
>>>
>>> ----- Original Message ----
>>> From: Leonidas Papadakis <it@creteonline.gr>
>>> To: Struts Users Mailing List <user@struts.apache.org>
>>> Sent: Saturday, September 22, 2007 4:22:04 PM
>>> Subject: Re: [s2] How do I output unicode characters please help
>>>
>>> Hi there,
>>>
>>> in my Greek scenario i have set the below in struts.properties file :
>>> struts.i18n.encoding=UTF-8
>>> struts.locale = el_GR
>>>
>>> in my freemarker.properties :
>>> default_encoding=UTF-8
>>> locale=el_GR
>>>
>>> in my jsp file :
>>> <%@ page contentType="text/html; charset=utf-8" %>
>>>
>>> Also check the doctype of your resulting html.
>>>
>>> I hope this will help ....
>>>
>>> Regards
>>>
>>> Leon
>>>
>>> David Harland wrote:
>>>  
>>>> Hi,
>>>>
>>>> If I put the following \u00fc in a properties file and use it in a 
>>>> jsp i get the german character u" output. If I have an action with 
>>>> the variable test and I set it with \u00fc and I output it in a jsp I 
>>>> get the encoding &#xFC;.
>>>>
>>>> How do I get the character instead of this encoding please?
>>>>
>>>> Thanks
>>>>
>>>> Dave.
>>>>
>>>>
>>>>
>>>>
>>>>       
>>>> ____________________________________________________________________________________

>>>>
>>>> Don't let your dream ride pass you by. Make it a reality with Yahoo! 
>>>> Autos.
>>>> http://autos.yahoo.com/index.html
>>>>  
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>        
>>> ____________________________________________________________________________________

>>>
>>> Pinpoint customers who are looking for what you sell. 
>>> http://searchmarketing.yahoo.com/
>>>
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-s2--How-do-I-output-unicode-characters-please-help-tp12837085p14414610.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message