2 Replies Latest reply on Jul 19, 2007 8:50 AM by kgoedert

    character encoding problem

    kgoedert

      Hi,

      I have an application that needs iso-8859-1 characters. I´m using facelets and I have a template like this:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">


      <ui:insert name="pageHeader"/>


      <ui:insert name="body"/>
      ....

      In the pageHeader page I also have
      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      because of special characters for de page title. But when accessing the page I get this error

      Error processing XML --- <?xml version="1.0" encoding="ISO-8859-1"?>

      Because this line ends up inside of the element.
      If I take this declaration off I get an Invalid UTF-8 character.

      How can I solve this?

        • 1. Re: character encoding problem
          rapowder

          pageHeader shouldn't be a page, but you have to define the content that replaces it in each page that uses your template:

          <ui:define name="pageHeader">
          ....
          </ui:define>


          Why don't you put the charset declaration in the html head (which should be in your template file)?

          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
          ..
          </head>
          


          • 2. Re: character encoding problem
            kgoedert

            When you said, that pageHeader shoudn´t be a page, you meant it shouldn´t be a separate file? I did redifine it for every page because I import different css and js files for each one.

            I did try to put
            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

            on the main page put it didn´t help.
            Any other ideas?

            Thanks for your help