The Artima Developer Community
Sponsored Link

Java Buzz Forum
Fixing Velocity's character encoding problems

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Nick Lothian

Posts: 397
Nickname: nicklothia
Registered: Jun, 2003

Nick Lothian is Java Developer & Team Leader
Fixing Velocity's character encoding problems Posted: Nov 28, 2005 11:35 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Nick Lothian.
Original Post: Fixing Velocity's character encoding problems
Feed Title: BadMagicNumber
Feed URL: http://feeds.feedburner.com/Badmagicnumber
Feed Description: Java, Development and Me
Latest Java Buzz Posts
Latest Java Buzz Posts by Nick Lothian
Latest Posts From BadMagicNumber

Advertisement

I quite like writing quick web applications using Spring and Velocity. I've often been annoyed by the fact that I quite often get character encoding problems:
Encoding problem
Today I finally got around to looking into this and fixing it. It turns out that Velocity defaults to using the ISO-8859-1 encoding. Using Spring's VelocityViewResolver this can be changed:


	<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
		<property name="cache" value="true"/>
		<property name="prefix" value=""/>
		<property name="suffix" value=".vm"/>
		<property name="contentType" value="text/html; charset=UTF-8"/>
	</bean>
With that change characters display as expected:
Problems Fixed
As usual: if I'd known how easy it was I'd have done it sooner...

Read: Fixing Velocity&#39;s character encoding problems

Topic: Stupid Nasty Spammer of The Day - My-Pills-be Previous Topic   Next Topic Topic: How To Display Blog Statistics Like This Blog?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use