One quick thing to try - remove the lines:

<% response.setContentType("text/html; charset=UTF-8"); %>

and

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >

Then, add the directive:

<%@ page pageEncoding="UTF-8" %>

Also import like so:

<c:import url="/reports.xml" charEncoding="UTF-8"/>

Does that change anything?

Eric Webster wrote:
Perhaps someone can tell me if this is a bug or if I'm doing something wrong.

I have an XML document with some UTF-8 encoded strings in it. The XML document is labeled as being encoded in UTF-8. I want to print those strings out using the x:out tag in a UTF-8 encoded JSP. The problem seems to be that strings which come out of x:out are always labeled as being ISO-8859-1 encoded. This causes the JspWriter to perform an unnecessary ISO-8859-1 to UTF-8 conversion on the string. The resulting page is UTF-8 but the strings are incorrect due to the conversion. (At least thats what I think is going on.)

I've discovered a workaround to this problem. I create a new UTF-8 string based on the getBytes() of the string that comes out of x:out. These strings show up correctly.

I'm using Tomcat 5.5 and Standard-1.1 taglibs. Any thoughts? I'd rather not have to use the workaround.




------------------------------------------------------------------------


<% response.setContentType("text/html; charset=UTF-8"); %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd";>

<%@ taglib prefix="c"   uri="http://java.sun.com/jstl/core"; %>
<%@ taglib prefix="x"   uri="http://java.sun.com/jstl/xml"; %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"; %>

<html>
<body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
</head>

<c:if test="${empty applicationScope.reportList}">
<x:parse var="reportList" scope="application">
   <c:import url="/reports.xml" />
</x:parse>
</c:if>

<%-- <h2>Reports</h2> --%>

<x:forEach var="reportset" select="$reportList/reports/*">
        <c:set var="tempString" scope="page"><x:out 
select="$reportset/@name"/></c:set>
        <h3><% out.print(new String(pageContext.getAttribute("tempString").toString().getBytes(), 
"UTF-8")); %></h3>
        <%-- <h3><x:out select="$reportset/@name"/></h3> --%>
        <x:forEach var="reportSubSet" select="$reportset/*">
                <c:set var="tempString" scope="page"><x:out 
select="$reportSubSet/@name"/></c:set>
                <h4><% out.print(new 
String(pageContext.getAttribute("tempString").toString().getBytes(), "UTF-8")); %></h4>
                <%-- <h4><x:out select="$reportSubSet/@name"/></h4> --%>
                <ul>
                <x:forEach var="report" select="$reportSubSet/*">
                        <c:set var="id"><x:out select="$report/@id"/></c:set>
                        <c:url var="htmlurl" value="reportViewer">
                                <c:param name="report" value="${id}"/>
                                <c:param name="format" value="html"/>
                        </c:url>
                        <c:url var="pdfurl" value="reportViewer">
                                <c:param name="report" value="${id}"/>
                                <c:param name="format" value="pdf"/>
                        </c:url>
                        <c:url var="csvurl" value="reportViewer">
                                <c:param name="report" value="${id}"/>
                                <c:param name="format" value="csv"/>
                        </c:url>
                        <c:url var="xlsurl" value="reportViewer">
                                <c:param name="report" value="${id}"/>
                                <c:param name="format" value="xls"/>
                        </c:url>          
                                        
                        <li><a href='<c:out value="${htmlurl}"/>'>
                        <%-- <x:out select="$report/title"/> --%>
                        <c:set var="tempString" scope="page"><x:out 
select="$report/title"/></c:set>
                        <% out.print(new 
String(pageContext.getAttribute("tempString").toString().getBytes(), "UTF-8")); %>
                        </a>
                        &nbsp
                        <font size="2pt">
                        <a href='<c:out value="${pdfurl}"/>'/>pdf</a>
                        &nbsp
                        <a href='<c:out value="${csvurl}"/>'/>csv</a>
                        &nbsp
                        <a href='<c:out value="${xlsurl}"/>'/>excel</a>
                        </font>   
                        </li>
                </x:forEach>
                </ul>
        </x:forEach>
</x:forEach>

</body>
</html>


------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<reports name="Évaluation et surveillance">
  <reportSet name="PEPFAR">
    <reportSubSet name="Rapports de population totale">
      <report id="505">
        <title>Rapport mensuel Pepfar par établissement</title>
        <reportFile></reportFile>
      </report>
    </reportSubSet>
    <reportSubSet name="Statistiques de cohorte totale">
      <report id="500">
        <title>Nombre de patients par établissement</title>
        <reportFile>TotalCohortPatientCount.jasper</reportFile>
      </report>
      <report id="501">
        <title>Facteurs de risque CDC</title>
        <reportFile>RiskFactors.jasper</reportFile>
      </report>
      <report id="502">
        <title>Patients par groupe d'âge</title>
        <reportFile>AgeGroups.jasper</reportFile>
      </report>
      <report id="503">
        <title>ARV par mois</title>
        <reportFile>ArvByMonth.jasper</reportFile>
      </report>
      <report id="504">
        <title>Comptes de régime par mois</title>
        <reportFile>RegimenByMonth.jasper</reportFile>
      </report>
    </reportSubSet>
    <reportSubSet name="Distribution de cohorte par étabilssement - Tous les 
patients">
      <report id="100">
        <title>Nombre par sexe</title>
        <reportFile>CohortSex.jasper</reportFile>
      </report>
      <report id="102">
        <title>Age à la première visite</title>
        <reportFile>AgeFirstVisit.jasper</reportFile>
      </report>
      <report id="103">
        <title>Facteurs de risque CDC</title>
        <reportFile>CohortRiskFactors.jasper</reportFile>
      </report>
      <report id="104">
        <title>Diagnostics</title>
        <reportFile>CohortDiagnosis.jasper</reportFile>
      </report>
      <report id="105">
        <title>Résultats d''analyse de laboratoire</title>
        <reportFile>CohortLabResult.jasper</reportFile>
      </report>
      <report id="106">
        <title>Medicaments</title>
        <reportFile>CohortMedication.jasper</reportFile>
      </report>
      <report id="107">
        <title>Décès par année</title>
        <reportFile>DeathsByYear.jasper</reportFile>
      </report>
      <report id="108">
        <title>Visites par mois</title>
        <reportFile>VisitsByMonth.jasper</reportFile>
      </report>
      <report id="109">
        <title>Nombre de fiches saisies la semaine dernière</title>
        <reportFile>FormsLastWeek.jasper</reportFile>
      </report>
      <report id="110">
        <title>Nombre de fiches saisies la mois dernière</title>
        <reportFile>FormsLastMonth.jasper</reportFile>
      </report>
      <report id="111">
        <title>ARV par mois</title>
        <reportFile>CohortArvByMonth.jasper</reportFile>
      </report>
      <report id="112">
        <title>Comptes de régime par mois</title>
        <reportFile>CohortRegimenbyMonth.jasper</reportFile>
      </report>
    </reportSubSet>                       
  </reportSet>
  <reportSet name="Rapports de cas particulier">
    <reportSubSet name="Rapports de cas particulier">
      <report id="200">
        <title>NASTAD Individual Case Report</title>
        <reportFile></reportFile>
      </report>
    </reportSubSet>
  </reportSet>
  <reportSet name="Data Quality Reports">
    <reportSubSet name="Critères d''enrollement">
      <report id="301">
        <title>Patients n'ayant pas eu 2 visites durant 12 mois</title>
        <reportFile>PatientsWithoutTwoVisits.jasper</reportFile>
      </report>
      <report id="302">
        <title>Patients sans désignation de sexe</title>
        <reportFile>PatientsNoSex.jasper</reportFile>
      </report>
      <report id="303">
        <title>Patients sans année de naissance</title>
        <reportFile>PatientsWithoutBirthYear.jasper</reportFile>    
      </report>
      <report id="304">
        <title>Activité post mortem</title>
        <reportFile>PostMortemActivity.jasper</reportFile>
      </report>                                                   
    </reportSubSet>
    <reportSubSet name="Autres rapports">
      <report id="305">
        <title>Date de visite ultérieure à la date d'entrée des 
données</title>
        <reportFile>VisitDateAfterToday.jasper</reportFile>
      </report>
      <report id="306">
        <title>Fiche exigeant la revue de qualitè de donnèes</title>
        <reportFile>QualityReview.jasper</reportFile>
      </report>
      <report id="307">
        <title>Nombre de saisies essentielles incomplètes</title>
        <reportFile>IncompleteForms.jasper</reportFile>
      </report>
      <report id="308">
        <title>Mauvaise Date De Visite</title>
        <reportFile>BadVisitDate.jasper</reportFile>
      </report>
    </reportSubSet>
  </reportSet>
  <reportSet name="Rapports de soins cliniques">
    <reportSubSet name="Rapports de soins cliniques">
      <report id="601">
        <title>Patients sans numération CD4</title>
        <reportFile>NoCD4.jasper</reportFile>
      </report>
      <report id="602">
        <title>Patients sans numération CD4 depuis plus de 6 mois</title>
        <reportFile>OldCD4.jasper</reportFile>
      </report>
      <report id="603">
        <title>Patients ayant manqué 3 rendez-vous ces 3 derniers mois</title>
        <reportFile>MissedThreeVisits.jasper</reportFile>   
      </report>
      <report id="604">
        <title>Patients sans résultat RPR</title>
        <reportFile>NoRPR.jasper</reportFile>
      </report>                           
      <report id="605">
        <title>Patients sous traitement ARV depuis 1 mois et sans suivi 
SGOT/SGPT</title>
        <reportFile>NoSGOT.jasper</reportFile>
      </report>
      <report id="606">
        <title>Patients sous traitement ARV depuis 1 mois et sans suivi du taux de 
créatinine</title>
        <reportFile>NoCreatinine.jasper</reportFile>
      </report>
      <report id="607">
        <title>Patients sous traitement ARV depuis 1 mois et sans suivi de 
Hg</title>
        <reportFile>NoHg.jasper</reportFile>
      </report>
      <report id="608">
        <title>Patients sans résultat de radiographie thoracique</title>
        <reportFile>NoXray.jasper</reportFile>
      </report>
      <report id="609">
        <title>Patients sans résultat de crachat</title>
        <reportFile>NoSputum.jasper</reportFile>
      </report>
      <report id="610">
        <title>Patients sans résultat PPD</title>
        <reportFile>NoPPD.jasper</reportFile>
      </report>
      <report id="611">
        <title>Patients éligibles pour traitement ARV mais non inscrit</title>
        <reportFile>NotEnrolled.jasper</reportFile>
      </report>
      <report id="612">
        <title>Patients avec CD4 &lt; 200 n'étant pas sous Cotrimox</title>
        <reportFile>NotOnCotrimox.jasper</reportFile>
      </report>
    </reportSubSet>
  </reportSet>
</reports>

--
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to