• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is the -Dfile.encoding server setting used for compliation of Java classes?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont work on servers but our server guy set the java start up options on unix as follows -Dfile.encoding=ISO-8859-1 and all the content coming from a form in a JSP is now being returned with the right encoding for special chars.

Does anyone know if this change means that this encoding is also used when the java classes in the app are compiled as well? or is it only used to set the encoding of the JSP's? Note: the app gets compiled on the server using Maven.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Does anyone know if this change means that this encoding is also used when the java classes in the app are compiled as well?



It would not matter if the encoding is applied at compile time. The option that you mentioned is the default one that is consulted when a program runs at runtime. More here -> http://www.jguru.com/faq/view.jsp?EID=78088

Did you mean to say runtime ?
 
Adrian Airmil
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:

Does anyone know if this change means that this encoding is also used when the java classes in the app are compiled as well?



It would not matter if the encoding is applied at compile time. The option that you mentioned is the default one that is consulted when a program runs at runtime. More here -> http://www.jguru.com/faq/view.jsp?EID=78088

Did you mean to say runtime ?


No, I was referring to compile time. I de-compiled the class and the special chars, that are used in property values, show up as '\uFFFD'. Thus at run time they get rendered as a '?'. I was wondering if that default option also gets used at runtime. In that case I dont have to look into specifying encoding in Maven for the compilation of the app.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no concept of choosing encoding at compile time. Encoding is always decided when the conversion occurs.

I de-compiled the class and the special chars, that are used in property values, show up as '\uFFFD'



You are probably looking at a constant that was stored as 16 bit unicode.

Thus at run time they get rendered as a '?'



The \uFFFD character is a place holder for those characters that cannot be converted correctly.
 
Adrian Airmil
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:There is no concept of choosing encoding at compile time. Encoding is always decided when the conversion occurs.


Really? I'm confused now. I received this advice : Special chars not being sent correctly in email
And since we are using Maven I was considering this : Specifying a character encoding scheme

But before doing that I wanted to verify if the -Dfile.encoding server setting was used for compliation of Java classes when the app is compiled on the server/unix box and hence this thread. If the answer is yes then I dont need to change any POM file to rebuild the app.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adrian,

It appears I was incorrect. The javac documentation does mention a -encoding flag during compilation time.

http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javac.html

I have never had to deal with this before, so the flag escaped my attention. I am not sure how the replacement character came to be. Perhaps like you mention, the flag must have not been used during compile time. I will play around with the flag and try to confirm this for you.

Sorry about confusing you previously.
 
Adrian Airmil
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the clarification, Deepak. I've never had to use the -encoding flag before as well and hence all these questions

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic