Re: Charset (Struts and Velocity)

2005-02-14 Thread Shinobu Kawai
Hi Nathan,

   the VelocityViewServlet (largely in the interest of compatibility with
   VelocityServlet) does take the output.encoding property into account,
   but only if there is no charset specified within the
   default.contentType property.
 
  Didn't know that.  Maybe it needs to get it the docs.  :)
  ## Or is it already there?
 
 no, i don't think it's documented anywhere.  any good idea for where
 such a note should go?

I would definitely want one in the VVS javadoc and/or view tool top
page.  Would it be comfortable in the Velocity developer guide?

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

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



Re: Charset (Struts and Velocity)

2005-02-14 Thread Shinobu Kawai
Hi Markos,

  It's all Java stuff.  Java stores data in memory as Unicode, so
  everything going into Java must be converted into Unicode.  Currently,
  there is no way Java can tell whether a file is ascii or Greek or
  Japanese or whatever.  So, you have to Unicode escape the files.
  native2ascii makes life a bit easier.  ;)
 
 Ok this is true, and maybe we are getting a bit out of topic but, why cant I
 just save the file in UTF-8 format? Isn't that unicode? :/

The quick answer is, because that's how it's implemented.

 Also, while searching for a solution I came across the load(InputStream)
 method of java.util.Properties which has the value of charset hardcoded to
 8859_1 which made me wonder...

But I guess you already know that...  So you see, although Java
internally uses unicode, Properties only accepts ascii files for
external storage.  Of course, you always have the choice to hack
Struts.  ;)

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

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



Re: Charset (Struts and Velocity)

2005-02-14 Thread Nathan Bubna
On Mon, 14 Feb 2005 01:01:23 -0800, Shinobu Kawai
[EMAIL PROTECTED] wrote:
 Hi Nathan,
 
the VelocityViewServlet (largely in the interest of compatibility with
VelocityServlet) does take the output.encoding property into account,
but only if there is no charset specified within the
default.contentType property.
  
   Didn't know that.  Maybe it needs to get it the docs.  :)
   ## Or is it already there?
 
  no, i don't think it's documented anywhere.  any good idea for where
  such a note should go?
 
 I would definitely want one in the VVS javadoc and/or view tool top
 page.  

wanna make a patch? :)

Would it be comfortable in the Velocity developer guide?

i dunno, but certainly not unless/until the VVS makes it in there too.

 Best regards,
 -- Shinobu
 
 --
 Shinobu Kawai [EMAIL PROTECTED]
 
 -
 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]



Re: Charset (Struts and Velocity)

2005-02-14 Thread Shinobu Kawai
Hi Nathan,

   no, i don't think it's documented anywhere.  any good idea for where
   such a note should go?
 
  I would definitely want one in the VVS javadoc and/or view tool top
  page.
 
 wanna make a patch? :)

I'll file a bugzilla issue for you.  ;)
## I'll make the patch if I have some extra time.

 Would it be comfortable in the Velocity developer guide?
 
 i dunno, but certainly not unless/until the VVS makes it in there too.

Figured you would say that.  :)

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread Markos Charatzas
On Friday 11 February 2005 07:21, Shinobu Kawai wrote:
 resource files and charset might be your problem.  Do you mean
 your resource files have non-ascii characters in it?  If so, that's
 your problem.  They must be escaped java-wise like \u1234.
 cf.
 http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding


Yes, they actually have Greek character so I have saved them in ISO-8859-7

Ok here is what I've done.
I removed the contentType declaration in struts-config.xml
Now, in velocity.properties *if* i put either 

output.encoding=ISO-8859-7
or
default.contentType=text/html; charset=ISO-8859-7

then all data coming from the resource bundles isnt displayed properly ()

if I remove either declaration in velocity.properties then the data displays 
correctly *but* all data (encoded in ISO-8859-7) made available to velocity 
via the request.setAttribute(String, Object) is displayed as ???. 

:S

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread Markos Charatzas
Just to point out that the data stored in the DB is using cp-1253 :/

So far I didnt have to deal with ResourceBundles so all text was inside the 
HTML templates.

I cant seem to understand why setting the output encoding in 
velocity.properties to ISO-8859-7 would cause the data coming from the 
ResourceBundles not to display properly since *its encoded* in that same 
charset :/

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread Markos Charatzas
On Friday 11 February 2005 07:21, Shinobu Kawai wrote:
They must be escaped java-wise like \u1234.

Shinobu I did that and it worked. Thanks.

Although I find it a bit hard to accept that any resource bundle must be in 
that format. That makes life a bit harder :/

Still I cannot understand why setting the output.encoding to ISO-8859-7 in 
velocity.properties has that effect I mentioned earlier. 

Even more since you pointed out that the output.encoding doesn't matter unless 
you're using VelocityServlet or Anakia and Im using VelocityViewServlet

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread Shinobu Kawai
Hi Markos,

 They must be escaped java-wise like \u1234.
 
 Shinobu I did that and it worked. Thanks.

Welcome.  :)

 Although I find it a bit hard to accept that any resource bundle must be in
 that format. That makes life a bit harder :/

It's all Java stuff.  Java stores data in memory as Unicode, so
everything going into Java must be converted into Unicode.  Currently,
there is no way Java can tell whether a file is ascii or Greek or
Japanese or whatever.  So, you have to Unicode escape the files. 
native2ascii makes life a bit easier.  ;)

 Still I cannot understand why setting the output.encoding to ISO-8859-7 in
 velocity.properties has that effect I mentioned earlier.
 
 Even more since you pointed out that the output.encoding doesn't matter unless
 you're using VelocityServlet or Anakia and Im using VelocityViewServlet

That IS weird.  Somebody might want to look into that.

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread Markos Charatzas
On Friday 11 February 2005 17:45, Shinobu Kawai wrote:
 It's all Java stuff.  Java stores data in memory as Unicode, so
 everything going into Java must be converted into Unicode.  Currently,
 there is no way Java can tell whether a file is ascii or Greek or
 Japanese or whatever.  So, you have to Unicode escape the files.
 native2ascii makes life a bit easier.  ;)

Ok this is true, and maybe we are getting a bit out of topic but, why cant I 
just save the file in UTF-8 format? Isn't that unicode? :/

Also, while searching for a solution I came across the load(InputStream) 
method of java.util.Properties which has the value of charset hardcoded to 
8859_1 which made me wonder...

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread mailmur
 On Friday 11 February 2005 17:45, Shinobu Kawai
 wrote:
  It's all Java stuff.  Java stores data in memory
 as Unicode, so
  everything going into Java must be converted into
 Unicode.  Currently,
  there is no way Java can tell whether a file is
 ascii or Greek or
  Japanese or whatever.  So, you have to Unicode
 escape the files.
  native2ascii makes life a bit easier.  ;)
 
 Ok this is true, and maybe we are getting a bit out
 of topic but, why cant I 
 just save the file in UTF-8 format? Isn't that
 unicode? :/
 
 Also, while searching for a solution I came across
 the load(InputStream) 
 method of java.util.Properties which has the value
 of charset hardcoded to 
 8859_1 which made me wonder...

See my webpage and about UnicodeFileResourceLoader
extension.
http://koti.mbnet.fi/akini/java/unicodereader/

My loader handles properly UTF-8 BOM marker, which you
will get if use windows Notepad. Bom marker is a good
thing, but current java readers cannot handle it
properly (but do handle fine UTF-16 bom markers).

Java default uses ISO-8859-1 as an encoding if one is
not explicitly given. It is a source of various
problems in internationalization issues.

I always save all java .properties files as UTF-8 file
and load them with java.io.StreamInputStream instance
or my UnicodeInputStream/Reader utility classes.

If you generate web pages, _always_ assign
response.setContentType(text/html; charset=UTF-8) to
make life easier at browser side.



__ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread Nathan Bubna
On Fri, 11 Feb 2005 07:45:19 -0800, Shinobu Kawai
[EMAIL PROTECTED] wrote:
...
  Still I cannot understand why setting the output.encoding to ISO-8859-7 in
  velocity.properties has that effect I mentioned earlier.
 
  Even more since you pointed out that the output.encoding doesn't matter 
  unless
  you're using VelocityServlet or Anakia and Im using VelocityViewServlet
 
 That IS weird.  Somebody might want to look into that.

the VelocityViewServlet (largely in the interest of compatibility with
VelocityServlet) does take the output.encoding property into account,
but only if there is no charset specified within the
default.contentType property.

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread Shinobu Kawai
Hi Nathan,

   Still I cannot understand why setting the output.encoding to ISO-8859-7 in
   velocity.properties has that effect I mentioned earlier.
  
   Even more since you pointed out that the output.encoding doesn't matter 
   unless
   you're using VelocityServlet or Anakia and Im using VelocityViewServlet
 
  That IS weird.  Somebody might want to look into that.
 
 the VelocityViewServlet (largely in the interest of compatibility with
 VelocityServlet) does take the output.encoding property into account,
 but only if there is no charset specified within the
 default.contentType property.

Didn't know that.  Maybe it needs to get it the docs.  :)
## Or is it already there?

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

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



Re: Charset (Struts and Velocity)

2005-02-11 Thread Nathan Bubna
On Fri, 11 Feb 2005 13:59:38 -0800, Shinobu Kawai
[EMAIL PROTECTED] wrote:
 Hi Nathan,
 
Still I cannot understand why setting the output.encoding to ISO-8859-7 
in
velocity.properties has that effect I mentioned earlier.
   
Even more since you pointed out that the output.encoding doesn't matter 
unless
you're using VelocityServlet or Anakia and Im using VelocityViewServlet
  
   That IS weird.  Somebody might want to look into that.
 
  the VelocityViewServlet (largely in the interest of compatibility with
  VelocityServlet) does take the output.encoding property into account,
  but only if there is no charset specified within the
  default.contentType property.
 
 Didn't know that.  Maybe it needs to get it the docs.  :)
 ## Or is it already there?

no, i don't think it's documented anywhere.  any good idea for where
such a note should go?

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


Re: Charset (Struts and Velocity)

2005-02-10 Thread Markos Charatzas
Hi Shinobu,

 #*
 Actually, the output.encoding doesn't matter unless you're using
 VelocityServlet or Anakia.  ;)

Yeap you are right...it must have been there since we migrated to 
VelocityViewServlet :)

 Please refresh my memory.  Was there a way to specify content type
 in resource files?  I thought they were just PropertyResourceBundle
 files.

I meant charset, thanks for pointing that out.

 Question marks usually means that the charset converter couldn't find
 the suitable character for the conversion.  If you spit out some log
 from java, is it encoded properly, or do you get question marks there,
 too?

Yeah, everything comes out fine in all except when the output comes from a 
resource bundle :/

Thank you.

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



Re: Charset (Struts and Velocity)

2005-02-10 Thread Nathan Bubna
disclaimeri've only halfheartedly read this thread and personally
never use non-default charsets/disclaimer

have you tried setting the default.contentType property that the VVS
looks for?

e.g.  default.contentType=text/html; charset=ISO-8859-1

i'm half-doubting that's the problem, but it wouldn't hurt to try.

On Thu, 10 Feb 2005 12:54:43 +0200, Markos Charatzas [EMAIL PROTECTED] wrote:
 Hi Shinobu,
 
  #*
  Actually, the output.encoding doesn't matter unless you're using
  VelocityServlet or Anakia.  ;)
 
 Yeap you are right...it must have been there since we migrated to
 VelocityViewServlet :)
 
  Please refresh my memory.  Was there a way to specify content type
  in resource files?  I thought they were just PropertyResourceBundle
  files.
 
 I meant charset, thanks for pointing that out.
 
  Question marks usually means that the charset converter couldn't find
  the suitable character for the conversion.  If you spit out some log
  from java, is it encoded properly, or do you get question marks there,
  too?
 
 Yeah, everything comes out fine in all except when the output comes from a
 resource bundle :/
 
 Thank you.
 
 -
 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]



Re: Charset (Struts and Velocity)

2005-02-10 Thread Shinobu Kawai
Hi Markos,

  Please refresh my memory.  Was there a way to specify content type
  in resource files?  I thought they were just PropertyResourceBundle
  files.
 
 I meant charset, thanks for pointing that out.
 
  Question marks usually means that the charset converter couldn't find
  the suitable character for the conversion.  If you spit out some log
  from java, is it encoded properly, or do you get question marks there,
  too?
 
 Yeah, everything comes out fine in all except when the output comes from a
 resource bundle :/

resource files and charset might be your problem.  Do you mean
your resource files have non-ascii characters in it?  If so, that's
your problem.  They must be escaped java-wise like \u1234.
cf. http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

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



Re: Charset (Struts and Velocity)

2005-02-09 Thread Shinobu Kawai
Hi Markos,

 Although,
 
 1. I have defined the charset in struts-config.xml like the following
 controller contentType=text/html; charset=ISO-8859-7/
 2. In velocity properties I have set both
 input.encoding=ISO-8859-7
 output.encoding=ISO-8859-7

#*
Actually, the output.encoding doesn't matter unless you're using
VelocityServlet or Anakia.  ;)
   
http://jakarta.apache.org/velocity/developer-guide.html#Velocity%20Configuration%20Keys%20and%20Values
*#

 3. my html templates have the content type set properly
 4. my resource files are in the corrent content type

Please refresh my memory.  Was there a way to specify content type
in resource files?  I thought they were just PropertyResourceBundle
files.

 I still get question marks (?) displayed back to the browser when displaying
 anything that comes from an ApplicationResource file :(

Question marks usually means that the charset converter couldn't find
the suitable character for the conversion.  If you spit out some log
from java, is it encoded properly, or do you get question marks there,
too?

Best regards,
-- Shinobu

--
Shinobu Kawai Yoshida [EMAIL PROTECTED]

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