File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Default encoding in spring. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Default encoding in spring." Watch "Default encoding in spring." New topic

Default encoding in spring.

pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 415

I have seen the following code to set default-encoding in spring:

But can any body tell me how to it in following pattern:

I have tried p:defaultEncoding="UTF-8" but it does not work.

Pawan Chopra
Brian Murphy

Joined: Jul 07, 2010
Posts: 8
Hey Pawan,

Do you get an error of some sort? The syntax you're suggesting does indeed work. Here's what it would look like.

Also note that you have to use unicode escapes to get UTF-8 support, or switch to using the XML format for message bundles. You can read more in the Properties JavaDocs -


Brian D. Murphy
pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 415

Sorry Brian....We were busy in some other work for 2 months. So couldn't look into it. now I ahve got the solution thanks to you. What I have noticed that with ReloadableResourceBundleMessageSource class we have to put classpath as prefix with basename property. This was the only problem. Thanks once again and sorry for such a late reply.
I agree. Here's the link:
subject: Default encoding in spring.
jQuery in Action, 3rd edition