Announcement Announcement Module
Collapse
No announcement yet.
Spring WEB MVC UTF-8 encoding problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring WEB MVC UTF-8 encoding problem

    HI All,

    I am facing a weird problem with charset in my spring mvc application.

    I have used a single MultiactionController for all views. Separate Form controllers for each form in my application.

    For each jsp, I am using i have explicitly set the charset and pageEncoding to UTF-8. I have set the charsetEncodingFilter with encoding param as UTF-8.

    My problem is all my forms are in UTF-8 and all my views from multiactionController are in ISO-8859-1. I have tried explicitly setting the responseHeaders, contentType to UTF-8. but noting worked.

    Is this a framework issue with Spring 2.5.
    I am using Spring 2.5, Hibernate 3 and jQuery for my development.

    Filter code in my web.xml
    Code:
    <filter>
    		<filter-name>CharacterEncodingFilter</filter-name>
    		<display-name>CharacterEncodingFilter</display-name>
    		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    		<init-param>
    			<param-name>encoding</param-name>
    			<param-value>UTF-8</param-value>
    		</init-param>
    	</filter>
    	<filter-mapping>
    		<filter-name>CharacterEncodingFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    code from my jps,
    Code:
    <%@ page language="java" contentType="text/html; charset=UTF-8"
    	pageEncoding="UTF-8" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    explicitly set the responseContentType in my MultiActionController
    Code:
    response.setContentType("text/html; charset=UTF-8");
    Is there any mistake in my configuration ?

    Please give me a solution, why is it only problem with my views(form less jsps) but not with my forms ?
    Is this the problem with controllers.

    Thanks,
    Vamsi

  • #2
    Hi All,

    There is no problem with spring, or my jsp declaration.
    I found that problem is with the
    Code:
    <fmt:
    tag of jstl which by default sets the encoding depend on the locale. But I couldnt find the work around for this.

    Did any face the same problem and have work around for this.
    Please provide with your solution.

    Vamsi

    Comment

    Working...
    X