Bug 31084 - fmt charset problem when data come from database (mysql 4.0.x)
Summary: fmt charset problem when data come from database (mysql 4.0.x)
Status: RESOLVED WORKSFORME
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-07 08:37 UTC by Lorenzo Sicilia
Modified: 2009-07-10 00:45 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Sicilia 2004-09-07 08:37:34 UTC
in version box there isn't 1.0.0.6.

I use jstl 1.0.0.6 and jvm sun 1.4.2 on my linux box. 

I have this small snippet:

<%@ taglib prefix="c"   uri="/WEB-INF/tld/c.tld" %>
<%@ taglib prefix="fmt" uri="/WEB-INF/tld/fmt.tld" %>
<%@ taglib prefix="sql" uri="/WEB-INF/tld/sql.tld" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>bug fmt</title>

</head>
<body>
<fmt:message key="catalogue.detail" /><br/>
<sql:query var="languageList">
    SELECT id_language,name FROM language
</sql:query>
 <c:forEach items="${languageList.rows}" var="languageRow">
    <c:out value="${languageRow.name}" />
</c:forEach>
</body>
</html>

and this table with mysql 4.0.x

CREATE TABLE `language` (
  `id_language` int(11) unsigned NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `code` varchar(4) NOT NULL default '',
  PRIMARY KEY  (`id_language`)
) TYPE=InnoDB AUTO_INCREMENT=4 ;

INSERT INTO `language` VALUES (1, 'italiano', 'it');
INSERT INTO `language` VALUES (2, 'française', 'fr');
INSERT INTO `language` VALUES (3, 'english', 'en');

in my web.xml I use:
<context-param>
 <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
 <param-value>localtext</param-value>
</context-param>

When I use a fmt tag the output from db it is wrong.
I get:
italiano fran?aise english

instead of:
 italiano française english

If I remove in web xml the fmt context param and I add in my page haeder:
<fmt:setBundle basename="localtext" />
<%
// bug fmt:setBundle. We need reset contentType
response.setContentType("text/html; charset=ISO-8859-1");
%>
it work fine
Comment 1 Henri Yandell 2007-12-07 05:47:36 UTC
I was unable to recreate this back when I dug into it. I suspect more so because
I didn't manage to put together the right test case than because I'm sure it's
not a bug.
Comment 2 Henri Yandell 2009-07-10 00:45:30 UTC
That said (back in 2007) - I don't see myself being able to create a better test case to show the problem. Resolving as I couldn't get it to exhibit. If it is a problem in 1.1.x of Standard (or trunk), please reopen with an attachment demonstrating the issue.

Sorry.