character set problem with JSF...pages
We have a character set problem with JSP pages, that we believe is caused by JSF (Java Server Faces).
Swedish, as most other languages, has a couple of characters unique to the language. They are ? ? ? with the capital representations ? ? In HTML they are coded as å ä ö You can't use that coding in JavaScript alert boxes however; JavaScript will print out the code instead of letting the browser convert them to their proper representation.
For this reason we use another approach. The characters are written, as the look, in the text property files of the web application. Each JSP page contains a line of code, to specify that the content shall be encoded to ISO-8859-1. Normally it works fine; ? ?och ?appear as ? ?and ?in the HTML source the web browser receives. However, if the page is generated by JSF the characters appear as ä å æ in the HTML source. For some reason JSF doesn't take notice of the encoding line but transforms the characters to their numerical representation.
The problem even appeares with JSP pages that do not contain JSF but are accessed through a link located in a JSF page. Say for example that you're using jsf:commandLink in one page to generate a link. If that link leads to a JSP without any JSF components, that page will still be affected by the problem. Some session configuration seem to have been passed on by the JSF code in the first page.
The code below shows what the page header look like in the application. Note the line in red, which contains the encoding information.
Is there a fix or a way to pass by this problem?
code: Example:
<%@page import="com.wmdata.raindance.fp.FPButton,
com.wmdata.raindance.portal.tool.Text,
com.wmdata.raindance.portal.TextProperties,
com.wmdata.raindance.portal.rdlist.RDList,
com.wmdata.raindance.portal.rdlist.RDListType,
com.wmdata.raindance.portal.rdlist.RDListFactory,
com.wmdata.raindance.portal.rdlist.RDListDo,
com.wmdata.raindance.fp.FPStatus" %>
<jsp:useBean id="fpUserData" scope="session" class="com.wmdata.raindance.fp.FPUserData" />
<jsp:useBean id="apUserData" scope="session" class="com.wmdata.raindance.ap.agetor.APUserData" />
<%
RDList rdList = RDListFactory.create(request);
%>
<!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">
<head>
<title><%= Text.get(TextProperties.RAINDANCEPORTALEN,fpUserData.getCultureSetting()) %></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css">
@import url("<%= fpUserData.getAbsURL("/style/default/RDPortalStyle.css") %>");
</style>
<script src="<%= fpUserData.getAbsURL("/script/RDPortalScript.js") %>" type="text/javascript"></script>
<script src="<%= fpUserData.getAbsURL("/script/RDSearchList.js") %>" type="text/javascript"></script>
<script src="<%= fpUserData.getAbsURL("/system/scriptLibrary.js") %>" type="text/javascript"></script>
</head>
<body id="bdyPage" onload="try{document.getElementById('namn').focus();}catch(e){}">
<div id="maskelement" class="maskelement"> </div>
<form method="post" target="_self" onsubmit="return false;" action="<%= fpUserData.getAbsURL("/anskaffning/status/statusCtrl.jsp")%>">
<script type="text/javascript">createSearchList("<%= fpUserData.getAbsURL("/") %>");</script>
<span class="heading">
<%= Text.get(TextProperties.SOKBESTALLNING, fpUserData.getCultureSetting()) %>
邃?br></span>

