Thank you Nathan and "mailmur", my problem is solved, it's just because I only saved properties file under UTF-8 with content like: tôi yêu Việt Nam, so it's not showed correctly. So, to let everything is showed correctly, I use http://pioneer.stereo.lu/converter.html to convert UTF-8 to decimal (/uXXX), so everything alright :).

Oh, by the way, I tried to use native2ascii of JDK to convert properties file to ascii with encoding 1258 (Windows Vietnamese), but the properties file is converted incorrectly, I don't know why?

:) again, thanks for all your help :")

----- Original Message ----- From: "mailmur" <[EMAIL PROTECTED]>
To: "Velocity Users List" <velocity-user@jakarta.apache.org>
Sent: Thursday, November 10, 2005 3:22 AM
Subject: Re: [HELP] browser counldn't recognize charset=UTF-8 in meta tag :(


Is your properties file read as UTF-8 encoded text
file?

You could test this like the following:
Properties p = <read your propfile as you do now>
if (p.getProperty("hello").equalsIgnoreCase("\uXXXX_
encoded_value")) { System.out.println("match ok"); }

This makes sure you have got the value correctly, if
its broken here already it will be broken in the
client end.

Few issues about UTF-8 support in java:
http://koti.mbnet.fi/akini/java/unicodereader/


--- Nathan Bubna <[EMAIL PROTECTED]> wrote:

not sure what else to tell you then.  it looks like
all your settings
are right and those settings work for others, so
maybe your settings
aren't getting picked up somehow.

the one other thing you might check, is whether
response.getWriter()
or getOutputStream() are being called somewhere
before the
setContentType() method is being called.  according
to the servlet api
docs, setContentType() must happen first.  given
what you've shown us
of your code so far, it seems unlikely that this is
happening, but i'm
fresh out of other ideas for you at this point.

perhaps you can play around with the encoding of the
VelocityStruts
example apps and compare those to your own in order
to narrow down
where the problem is.

On 11/7/05, Pham Anh Tuan <[EMAIL PROTECTED]>
wrote:
> Thank you Nathan, after I did follow your
instructs, it's still not work
> :( ...
>
> yes, I user Struts Framework, and in use something
like below:
>
> in web.xml
>  <!-- Filter to set character encoding on each
request -->
>  <filter>
>   <filter-name>Set Character
Encoding</filter-name>
>

<filter-class>filters.SetCharacterEncodingFilter</filter-class>
>   <init-param>
>    <param-name>encoding</param-name>
>    <param-value>UTF-8</param-value>
>   </init-param>
>  </filter>
>
>  <!-- Define filter mappings for the defined
filters -->
>  <filter-mapping>
>   <filter-name>Set Character
Encoding</filter-name>
>   <servlet-name>action</servlet-name>
>  </filter-mapping>
>
> before I posted this problem, I had tested the
case in which above filter
> (SetCharacterEncodingFilter) is erased, but, it's
still not work, I mean the
> content is showed incorrectly.
>
> :(
>
>
> *************************************************
> Pham Anh Tuan
> Java Developer, HR Assistant
> ICHI Corporation Vietnam.
> Room #1001, 37 Ton Duc Thang, Dist. 1
> Ho Chi Minh City, Vietnam.
> Phone: (+84) (08) 9105732
> Fax: (+84) (08) 9105734
> Cell: (+84) (0) 989 505897
> Email: [EMAIL PROTECTED]
> Website: http://www.ichi-corp.jp
> *************************************************
> ----- Original Message -----
> From: "Nathan Bubna" <[EMAIL PROTECTED]>
> To: "Velocity Users List"
<velocity-user@jakarta.apache.org>
> Sent: Tuesday, November 08, 2005 2:12 PM
> Subject: Re: [HELP] browser counldn't recognize
charset=UTF-8 in meta tag :(
>
>
> > try setting a full "default.contentType"
property in your
> > velocity.properties.  something like
> >
> > default.contentType = text/html; charset=UTF-8
> >
> > also, is there anything setting the content type
on the
> > HttpServletResponse before/during/after the
VelocityViewServlet gets
> > it?
> >
> > On 11/7/05, Pham Anh Tuan <[EMAIL PROTECTED]>
wrote:
> >> Set encoding in velocity properties file:
> >>

#----------------------------------------------------------------------------
> >> # T E M P L A T E  E N C O D I N G
> >>

#----------------------------------------------------------------------------
> >>
> >> input.encoding=UTF-8
> >> output.encoding=UTF-8
> >>
> >> -----------------------------------------------
> >> my .properties file (encoded UTF-8)
> >> hello=tưá»Yng chừng
> >>
> >>

-----------------------------------------------------
> >> my .vm file
> >> <html>
> >> <head>
> >> <meta http-equiv="content-type"
content="text/html; charset=utf-8">
> >> </head>
> >> <body>
> >> $test.hello
> >> </body>
> >> </html>
> >>

------------------------------------------------------
> >> what happened, plz help me :(
> >>
> >>
*************************************************
> >> Pham Anh Tuan
> >> Java Developer, HR Assistant
> >> ICHI Corporation Vietnam.
> >> Room #1001, 37 Ton Duc Thang, Dist. 1
> >> Ho Chi Minh City, Vietnam.
> >> Phone: (+84) (08) 9105732
> >> Fax: (+84) (08) 9105734
> >> Cell: (+84) (0) 989 505897
> >> Email: [EMAIL PROTECTED]
> >> Website: http://www.ichi-corp.jp
> >>
*************************************************
> >> ----- Original Message -----
> >> From: "Pham Anh Tuan" <[EMAIL PROTECTED]>
> >> To: "Velocity Users List"
<velocity-user@jakarta.apache.org>
> >> Sent: Tuesday, November 08, 2005 1:30 PM
> >> Subject: Re: [HELP] browser counldn't recognize
charset=UTF-8 in meta tag
> >> :(
> >>
> >>
> >> > thanks to Malcolm, but ... :( ...
> >> >
> >> > When I do the way you instruct, my browser is
automatically change
> >> > encoding to UTF-8, but, my properties's
content is showed incorrectly.
> >> > I
> >> > mean, before I change encoding in velocity
property file, everytime I
> >> > view
> >> > 1 .vm file and I want to view page's content
correctly, I must change
> >> > the
> >> > encode of that page by click on
View\Encoding\UTF-8, after that, page's
> >> > content is viewed correctly. But after I do
the way you show me, the
> >> > browser automatically change encode to UTF-8,
but ... content is showed
> >> > correctly :( ...
> >> >
> >> > I don't know what wrong, my properties file
(whose content is encoded
> >> > in
> >> > UTF-8) :( ..
> >> >
> >> >
> >> >
*************************************************
> >> > Pham Anh Tuan
> >> > Java Developer, HR Assistant
> >> > ICHI Corporation Vietnam.
> >> > Room #1001, 37 Ton Duc Thang, Dist. 1
> >> > Ho Chi Minh City, Vietnam.
> >> > Phone: (+84) (08) 9105732
> >> > Fax: (+84) (08) 9105734
> >> > Cell: (+84) (0) 989 505897
> >> > Email: [EMAIL PROTECTED]
> >> > Website: http://www.ichi-corp.jp
> >> >
*************************************************
> >> > ----- Original Message -----
> >> > From: "Malcolm Edgar"
<[EMAIL PROTECTED]>
> >> > To: "Velocity Users List"
<velocity-user@jakarta.apache.org>
> >> > Sent: Tuesday, November 08, 2005 11:51 AM
> >> > Subject: Re: [HELP] browser counldn't
recognize
=== message truncated ===





__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to