1

This is Spring MVC application. I put this to spring-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>

and this to web.xml

<?xml version="1.0" encoding="UTF-8"?>

and this to .jsp file at the top

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

and this to .jsp file insideof the html opening tag

<META  http-equiv="content-type" content="text/html; charset=UTF-8">

Still it displays only question marks instead of German umlaut characters. What else do I need to add?

Sanyifejű
  • 2,610
  • 10
  • 46
  • 73
  • You said that the JSP was encoded in UTF-8. But is it really encoded in UTF-8? Because if it's encoded in latin-1 for example, and you add the above header inside the JSP, that won't magically change the encoding of the file (just like sticking a "Beef" tag on a box full of chicken won't change the chicken into beef). – JB Nizet Sep 26 '12 at 07:54
  • Did you [set up Tomcat (is `URIEncoding="UTF-8"` in your ``)](http://stackoverflow.com/questions/138948/how-to-get-utf-8-working-in-java-webapps)? – Grzegorz Rożniecki Sep 26 '12 at 07:57
  • ok, so how can I "really" encode the JSP in UTF-8. I assume there is no problem with Tomcat because this is a problem with only the messages that come from bundle. The words that come from DB are displayed fine – Sanyifejű Sep 26 '12 at 08:29
  • That's something new. If you hard-code an umlaut directly in the JSP, is it working fine? How do you read and output the message from the bundle? What does the bundle file look like? What's its encoding? – JB Nizet Sep 26 '12 at 08:38
  • When I hardcode the umlauts in the .jsp file then everything works fine. – Sanyifejű Sep 26 '12 at 16:08
  • I output the massages the following way: – Sanyifejű Sep 26 '12 at 16:10
  • "What does the bundle file look like? What's its encoding?" the bundle files are normal properties file and contain data like this: go.back.to.practice.label=Gehe zum üben zurück I guess the bundle files have their default encoding, but I dont know how to change that. – Sanyifejű Sep 26 '12 at 16:15

1 Answers1

-1

In the properties file I need to use unicode escapes like as in \uXXXX for each character beyond the supported range of ISO-8859-1.

Sanyifejű
  • 2,610
  • 10
  • 46
  • 73