Character Encoding

Problem

Even if you have specified your Facelets XHTML page for UTF-8 encoding, some hard coded special character like german umlaut still causes the error:

com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 4-byte UTF-8 sequence.

Solution

This is not a Facelets problem, but belongs to a wrong file encoding in the NetBeans IDE. Ensure that your XHTML file has the correct encoding UTF-8 and not windows-1252 by checking the properties of the file directly using the context menu of right mouse button.

You can also choose UTF-8 as default character encoding in the source section of the NetBeans project properties for your total application, which defines how the IDE save and display your source files.
If you change this global setting it could be possible that some existing files could not be readed correctly anymore!

Resources

[1] JSF 1.2
[2] Mojarra 1.2_14

Johannes Hammoud Character Encoding 24.04.2012

I Coding : Community about Java programing

Language German+-

Java JSF JavaScript HTML CSS NetBeans GlassFish MySQL

Imprint

Visits
6279791
Today
7113