Using ISO-8859-1 Encoding

I am from Brazil, and here we have a lot à é ô ó ç, etc. in our words, and this is a problem in my JSF project.

I have master.xhtmlas a template for all my pages, and here it is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
        <meta http-equiv="pragma" content="no-cache"/>
        <link rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/assets/css/bootstrap.css" type="text/css" media="all" />
        <title>#{masterController.projectName}</title>
        <style type="text/css">
            body {
                padding-top: 60px;
                padding-bottom: 40px;
            }
            .sidebar-nav {
                padding: 9px 0;
            }
        </style>
    </h:head>
    <h:body>
        <ui:fragment rendered="#{loginController.isLoggedIn}">
            <ui:include src="../includes/top.xhtml"/>
        </ui:fragment>
        <ui:insert name="body" />
        <hr />
        <ui:fragment rendered="#{loginController.isLoggedIn}">
            <ui:include src="../includes/footer.xhtml" />
        </ui:fragment>
    </h:body>
    <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/assets/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/assets/js/bootstrap.min.js"></script>
</html>

As you can see, my xml encondig is correct as my meta tag Content-Type.

I use Eclipse and in my project Properties-> Resources I changed Text file encodingto ISO-8859-1.

I have a label on my page login.xhtmlthat goes inside master.xhtmlthat is called Usuário (User), if I use a symbol áand this word is wrong without it, I get this error:

exception

javax.servlet.ServletException: null source
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)

root cause

java.lang.IllegalArgumentException: null source
    java.util.EventObject.<init>(Unknown Source)
    javax.faces.event.SystemEvent.<init>(SystemEvent.java:67)
    javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:69)
    javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:69)
    com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:256)
    com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:245)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)

Accepting á, it works, but, as I said, in Portuguese it is necessary, and I am going to use many other characters with an accent.

+3
1

ISO-8859-1, UTF-8. JSF UTF-8, .

UTF-8 IDE, UTF-8 . Eclipse Window > Preferences > General > Workspace > Text File Encoding.

enter image description here

"" UTF-8 .

. :

+4

All Articles