You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lukasz Lenart <lu...@googlemail.com> on 2008/06/09 17:07:25 UTC

Re: Reading Application Resource saved as UTF8 file and showing polish characters in browser

Hi,

2008/6/9 Raghuveer <ra...@infotechsw.com>:

> Is it possible in struts to configure the controller to read the
> application
> resource file which is saved as UTF8 format?
>

You can use filter from Spring

    <filter>
        <filter-name>encodingFilter</filter-name>

<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>


    <filter-mapping>
        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

It is possible to save the notepad file in UTF8 instead of ANSII.


If such notepad support UTF-8, you can use Notepad++ or JDK tool
native2ascii which will convert ANSII file to UTF-8, there is also ant task
available or many IDEs support such convertion in fly


Regards
-- 
Lukasz
http://www.lenart.org.pl/

Re: Reading Application Resource saved as UTF8 file and showing polish characters in browser

Posted by Laurie Harper <la...@holoweb.net>.
The native2ascii tool should run the same anywhere. Make sure you 
specify both the input and the output encoding, and that the input 
encoding you specify really matches the encoding you've saved the 
properties file in.

L.

Raghuveer wrote:
> Hi,
> Native2ascii has generated Unicode characters on polish windows system.
> But could not generate Unicode characters on Windows English Operating
> System.
> 
> Thanks a lot to Lukasz and Laurie
> 
> -----Original Message-----
> From: Laurie Harper [mailto:laurie@holoweb.net] 
> Sent: Tuesday, June 10, 2008 2:24 AM
> To: user@struts.apache.org
> Subject: Re: Reading Application Resource saved as UTF8 file and showing
> polish characters in browser
> 
> Lukasz Lenart wrote:
>> Hi,
>>
>> 2008/6/9 Raghuveer <ra...@infotechsw.com>:
>>
>>> Is it possible in struts to configure the controller to read the
>>> application
>>> resource file which is saved as UTF8 format?
>>>
>> You can use filter from Spring
> 
> That wouldn't help, since it has nothing to do with resource file loading.
> 
>> It is possible to save the notepad file in UTF8 instead of ANSII.
>>
>> If such notepad support UTF-8, you can use Notepad++ or JDK tool
>> native2ascii which will convert ANSII file to UTF-8, there is also ant
> task
>> available or many IDEs support such convertion in fly
> 
> Unfortunately, it is not possible to *read* a resource file saved in 
> this way. Application resource files are implemented under the covers 
> using Java's PropertyResourceBundle which specifies [2] the file format 
> as Latin-1 (ISO-8859-1) encoding with Unicode escapes.
> 
> What you *can* do, however, is author the files in UTF-8 and then 
> post-process them into the correct encoding during the build process, 
> using any of the tools/techniques Lukasz suggests.
> 
> L.
> 
> [1] 
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/PropertyResourceBundle.htm
> l
> 
> [2] 
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding


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


RE: Reading Application Resource saved as UTF8 file and showing polish characters in browser

Posted by Raghuveer <ra...@infotechsw.com>.
Hi,
Native2ascii has generated Unicode characters on polish windows system.
But could not generate Unicode characters on Windows English Operating
System.

Thanks a lot to Lukasz and Laurie

-----Original Message-----
From: Laurie Harper [mailto:laurie@holoweb.net] 
Sent: Tuesday, June 10, 2008 2:24 AM
To: user@struts.apache.org
Subject: Re: Reading Application Resource saved as UTF8 file and showing
polish characters in browser

Lukasz Lenart wrote:
> Hi,
> 
> 2008/6/9 Raghuveer <ra...@infotechsw.com>:
> 
>> Is it possible in struts to configure the controller to read the
>> application
>> resource file which is saved as UTF8 format?
>>
> 
> You can use filter from Spring

That wouldn't help, since it has nothing to do with resource file loading.

> It is possible to save the notepad file in UTF8 instead of ANSII.
> 
> If such notepad support UTF-8, you can use Notepad++ or JDK tool
> native2ascii which will convert ANSII file to UTF-8, there is also ant
task
> available or many IDEs support such convertion in fly

Unfortunately, it is not possible to *read* a resource file saved in 
this way. Application resource files are implemented under the covers 
using Java's PropertyResourceBundle which specifies [2] the file format 
as Latin-1 (ISO-8859-1) encoding with Unicode escapes.

What you *can* do, however, is author the files in UTF-8 and then 
post-process them into the correct encoding during the build process, 
using any of the tools/techniques Lukasz suggests.

L.

[1] 
http://java.sun.com/j2se/1.5.0/docs/api/java/util/PropertyResourceBundle.htm
l

[2] 
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding



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


Re: Reading Application Resource saved as UTF8 file and showing polish characters in browser

Posted by Laurie Harper <la...@holoweb.net>.
Lukasz Lenart wrote:
> Hi,
> 
> 2008/6/9 Raghuveer <ra...@infotechsw.com>:
> 
>> Is it possible in struts to configure the controller to read the
>> application
>> resource file which is saved as UTF8 format?
>>
> 
> You can use filter from Spring

That wouldn't help, since it has nothing to do with resource file loading.

> It is possible to save the notepad file in UTF8 instead of ANSII.
> 
> If such notepad support UTF-8, you can use Notepad++ or JDK tool
> native2ascii which will convert ANSII file to UTF-8, there is also ant task
> available or many IDEs support such convertion in fly

Unfortunately, it is not possible to *read* a resource file saved in 
this way. Application resource files are implemented under the covers 
using Java's PropertyResourceBundle which specifies [2] the file format 
as Latin-1 (ISO-8859-1) encoding with Unicode escapes.

What you *can* do, however, is author the files in UTF-8 and then 
post-process them into the correct encoding during the build process, 
using any of the tools/techniques Lukasz suggests.

L.

[1] 
http://java.sun.com/j2se/1.5.0/docs/api/java/util/PropertyResourceBundle.html

[2] 
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding


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