Re: Encoding problem when deploying on production server

2008-05-20 Thread Thomas Mäder
Hi Sébastien,

If by resource files you mean .properties files, you cannot encode them in
utf-8. java.util.Properties always assumes ISO 8859-1 encoding when loading
.properties files

Thomas

On Mon, May 19, 2008 at 1:24 PM, Piller Sébastien [EMAIL PROTECTED]
wrote:

 Hello guys,

 I have a problem with the encoding of some text, on my deployment server
 (Unix/Linux). I use wicket to generate the body of emails, with this code:

   StringResponse stringResponse = new StringResponse();
   Response originalResponse = RequestCycle.get().getResponse();

   try {
   RequestCycle.get().setResponse(stringResponse);
   render();
   } finally {
   RequestCycle.get().setResponse(originalResponse);
   }

   return stringResponse.toString();

 All of my resources files are encoded with UTF8.

 When I use it on my development workstation, everything works fine. Every
 chars are properly rendered.

 But on the production server, it seems that the email is converted to
 ISO8859-1 (and special chars are not rendered properly in UTF8). But others
 web pages are properly rendered (I only have a problem when dealing with
 responses)

 Have you guys any idea on how to fix it? Do I have to do someting on the
 server config?

 Thank you vm!

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




Re: Encoding problem when deploying on production server

2008-05-20 Thread Piller Sébastien

Hi Thomas,

my files aren't .properties, they are .xml, encoded in utf8:

?xml version=1.0 encoding=UTF-8?
!DOCTYPE properties SYSTEM http://java.sun.com/dtd/properties.dtd;
properties
   entry key=nullidnull/entry
   entry key=submitSubmit/entry
   entry key=cancelCancel/entry
   ...
/properties  

But it isn't properly rendered when I use the StringResponse object, so 
I guess it use some default system charset to...


As said before, I'll ask my hoster for some infos on how to override 
this default setting.


Thx

Thomas Mäder a écrit :

Hi Sébastien,

If by resource files you mean .properties files, you cannot encode them in
utf-8. java.util.Properties always assumes ISO 8859-1 encoding when loading
.properties files

Thomas

On Mon, May 19, 2008 at 1:24 PM, Piller Sébastien [EMAIL PROTECTED]
wrote:


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



Re: Encoding problem when deploying on production server

2008-05-20 Thread Piller Sébastien

Hi Timo,

About the locale, I made a small jsp to show them.

- For the request, it is mine ( fr )
- For the response, it is specified as en_US.

But does the locale have an impact on how the character are encoded?

PS: I have asked my hosting, they swore me that everything is setted to
UTF-8 on theire side...

I really don't understand what's going on... I did everything utf8, they 
did everything utf8, and in the end I got iso88591...


Thank you for your time



Timo Rantalaiho a écrit :

What are the locales of the machines (or the users running
the server software on the machines)?

I think that by default, Java assumes the character encoding
it gets from the operating system, but you can override it 
by explicitly setting the relevant system property, 
-Dfile.encoding=utf-8 or something like that. 


The root problem is that property files are plain text files
that do not contain any metadata such as what encoding they
are written in, so anybody reading them just needs to assume
something. The same goes for Java source files. The problem
of property files is partially solved by using property XML
files, though it is a pity to lose the nice, simple property 
file syntax with the change.


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



Re: Encoding problem when deploying on production server

2008-05-20 Thread Johan Compagner
what are you doing with that StringResponse?
Because that string response still is just java so UTF
when that string is streamed or converted to bytes you should do something..

johan


On Mon, May 19, 2008 at 1:24 PM, Piller Sébastien [EMAIL PROTECTED]
wrote:

 Hello guys,

 I have a problem with the encoding of some text, on my deployment server
 (Unix/Linux). I use wicket to generate the body of emails, with this code:

   StringResponse stringResponse = new StringResponse();
   Response originalResponse = RequestCycle.get().getResponse();

   try {
   RequestCycle.get().setResponse(stringResponse);
   render();
   } finally {
   RequestCycle.get().setResponse(originalResponse);
   }

   return stringResponse.toString();

 All of my resources files are encoded with UTF8.

 When I use it on my development workstation, everything works fine. Every
 chars are properly rendered.

 But on the production server, it seems that the email is converted to
 ISO8859-1 (and special chars are not rendered properly in UTF8). But others
 web pages are properly rendered (I only have a problem when dealing with
 responses)

 Have you guys any idea on how to fix it? Do I have to do someting on the
 server config?

 Thank you vm!

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




Re: Encoding problem when deploying on production server

2008-05-20 Thread Piller Sébastien

Hi Johan,

Well, I then use the string returned by StringResponse#toString on 
Javamail, with that code:


   BodyPart htmlBodyPart = new MimeBodyPart();
   htmlBodyPart.setContent(htmlBody, text/html);
   multipart.addBodyPart(htmlBodyPart);
   ...

Is it possible to be a javamail issue?

I guess can you please confirm or infirm this?


Thank you ;)



Johan Compagner a écrit :

what are you doing with that StringResponse?
Because that string response still is just java so UTF
when that string is streamed or converted to bytes you should do something..

johan


On Mon, May 19, 2008 at 1:24 PM, Piller Sébastien [EMAIL PROTECTED]
wrote:


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



Re: Encoding problem when deploying on production server

2008-05-20 Thread Eirik Rude
Try setHeader(Content-Type,text/plain;charset=utf-8); on your message
for JavaMail.

Thanks,
Eirik Rude
http://www.i18now.com


On Tue, May 20, 2008 at 12:13 PM, Johan Compagner [EMAIL PROTECTED]
wrote:

 i think that is the place where you should look

 If you give it as a String to java mail then there is where the encoding
 takes place.

 johan

 On Tue, May 20, 2008 at 5:21 PM, Piller Sébastien [EMAIL PROTECTED]
 wrote:

  Hi Johan,
 
  Well, I then use the string returned by StringResponse#toString on
  Javamail, with that code:
 
BodyPart htmlBodyPart = new MimeBodyPart();
htmlBodyPart.setContent(htmlBody, text/html);
multipart.addBodyPart(htmlBodyPart);
...
 
  Is it possible to be a javamail issue?
 
  I guess can you please confirm or infirm this?
 
 
  Thank you ;)
 
 
 
  Johan Compagner a écrit :
 
  what are you doing with that StringResponse?
  Because that string response still is just java so UTF
  when that string is streamed or converted to bytes you should do
  something..
 
  johan
 
 
  On Mon, May 19, 2008 at 1:24 PM, Piller Sébastien [EMAIL PROTECTED]
  wrote:
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Encoding problem when deploying on production server

2008-05-20 Thread Eirik Rude
Make sure to do the same for body and subject.
body.setContent(msgtext, text/html;charset=utf-8);

Thanks,
Eirik Rude
http://www.i18now.com


On Tue, May 20, 2008 at 3:23 PM, Eirik Rude [EMAIL PROTECTED] wrote:

 Try setHeader(Content-Type,text/plain;charset=utf-8); on your message
 for JavaMail.

 Thanks,
 Eirik Rude
 http://www.i18now.com



 On Tue, May 20, 2008 at 12:13 PM, Johan Compagner [EMAIL PROTECTED]
 wrote:

 i think that is the place where you should look

 If you give it as a String to java mail then there is where the encoding
 takes place.

 johan

 On Tue, May 20, 2008 at 5:21 PM, Piller Sébastien [EMAIL PROTECTED]
 wrote:

  Hi Johan,
 
  Well, I then use the string returned by StringResponse#toString on
  Javamail, with that code:
 
BodyPart htmlBodyPart = new MimeBodyPart();
htmlBodyPart.setContent(htmlBody, text/html);
multipart.addBodyPart(htmlBodyPart);
...
 
  Is it possible to be a javamail issue?
 
  I guess can you please confirm or infirm this?
 
 
  Thank you ;)
 
 
 
  Johan Compagner a écrit :
 
  what are you doing with that StringResponse?
  Because that string response still is just java so UTF
  when that string is streamed or converted to bytes you should do
  something..
 
  johan
 
 
  On Mon, May 19, 2008 at 1:24 PM, Piller Sébastien [EMAIL PROTECTED]
  wrote:
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 





Encoding problem when deploying on production server

2008-05-19 Thread Piller Sébastien

Hello guys,

I have a problem with the encoding of some text, on my deployment server 
(Unix/Linux). I use wicket to generate the body of emails, with this code:


   StringResponse stringResponse = new StringResponse();
   Response originalResponse = RequestCycle.get().getResponse();

   try {
   RequestCycle.get().setResponse(stringResponse);
   render();
   } finally {
   RequestCycle.get().setResponse(originalResponse);
   }

   return stringResponse.toString();

All of my resources files are encoded with UTF8.

When I use it on my development workstation, everything works fine. 
Every chars are properly rendered.


But on the production server, it seems that the email is converted to 
ISO8859-1 (and special chars are not rendered properly in UTF8). But 
others web pages are properly rendered (I only have a problem when 
dealing with responses)


Have you guys any idea on how to fix it? Do I have to do someting on the 
server config?


Thank you vm!

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



Re: Encoding problem when deploying on production server

2008-05-19 Thread Timo Rantalaiho
On Mon, 19 May 2008, Piller Sébastien wrote:
 I have a problem with the encoding of some text, on my deployment server 
 (Unix/Linux). I use wicket to generate the body of emails, with this code:
...
 But on the production server, it seems that the email is converted to 
 ISO8859-1 (and special chars are not rendered properly in UTF8). But 
 others web pages are properly rendered (I only have a problem when 
 dealing with responses)

What are the locales of the machines (or the users running
the server software on the machines)?

I think that by default, Java assumes the character encoding
it gets from the operating system, but you can override it 
by explicitly setting the relevant system property, 
-Dfile.encoding=utf-8 or something like that. 

The root problem is that property files are plain text files
that do not contain any metadata such as what encoding they
are written in, so anybody reading them just needs to assume
something. The same goes for Java source files. The problem
of property files is partially solved by using property XML
files, though it is a pity to lose the nice, simple property 
file syntax with the change.

 Have you guys any idea on how to fix it? Do I have to do someting on the 
 server config?

locale -a
And debugging the file encoding system property of Java in 
each cases are good places to start.

I don't believe that this is Wicket related.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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