How to fix encoding problems on a web application page?

Asked

Viewed 635 times

2

I am developing a JAVA application with the Spring framework v3.1.0, however, when trying to access a page shows error of encoding:

Evoluã§

How to solve this problem? I found several ways, but none worked:

<servlet-container name="default" use-listener-encoding="true" default-encoding="UTF-8">
     <jsp-config/>
     <websockets/>
</servlet-container>

But it didn’t work, I also tried to put the filter in the web.xml file.:

<filter>
    <filter-name>encoding-filter</filter-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>
    <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>encoding-filter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

I also put in the header the type of encoding, and it didn’t work either:

<%@ page language="java" contentType="text/html; charset=UTF-8;" pageEncoding="UTF-8" %>

Of course, I also tried to pass this information via HTML:

<meta charset="UTF-8" />

The JSP file is also in UTF-8 and the browser is also.

Does anyone have a solution to this problem? This is my first application in this technology, I’m getting a little bit of this stuff.

Thanks in advance.

  • And as for the iso-8859-1?

  • Gives problem the same way, however, the UTF-8 is the standard on all levels: database, JSP, JS, CSS, etc...

  • 1

    Take a look in that reply.

  • This ai @Renan, your tip helped. Thank you so much.

  • @Ewertonmelo put as answer the solution he found, explains how he did to solve. Your answer can help other people who have the same problem.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.