JSP + MYSQL wrong chars
Posted by: vojtech.zavrel
Date: April 19, 2005 03:19PM

Hi,
I've got very serious problem, I've been trying to solve it for several week but without any result.

I have to use czech (Central European) chars. I had this with MySQL 4.0.18 database and everythig works fine. But several weeks ago I had to upgrade and since that I've got a lot of problems. Special czech chars don't work properely (se: ščřžíě)-displaying only squares or other chars. I realy don't know how to solve this problem. I've tried almost all posibilities, but nothing work. Anyone can help me?

I'm using:
Apache Tomcat 5.0.28
Jakarta taglibs - DBTags
MySQL 4.1.11
MySQL-Connector-java-3.0.16
JDK 1.5.0_02
NetBeans 4.0

My MySQL server configuration:
In MySQL administrator all character_set_variables are displayed as utf8 (I've also tried cp1250, latin1)

My WEB.XML document consist of:
<context-param>
<param-name>dbURL</param-name>
<param-value>jdbc:mysql://192.168.0.8:3306/jidelnawinsql?useUnicode=true&amp;characterEncoding=utf8</param-value>
</context-param>
<context-param>
<param-name>mysqlDriver</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</context-param>
<context-param>
<param-name>dbUserId</param-name>
<param-value>zw</param-value>
</context-param>
<context-param>
<param-name>dbPassword</param-name>
<param-value>zw</param-value>
</context-param>


My JSP file:
<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %>
<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags"; prefix="sql" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/session-1.0"; prefix="sess" %>
<%@ include file = "/inc/security.jsp" %>
<script type="text/JavaScript" src="js/functions.js"></script>
<sql:connection id="connectionMainDatabase">
<sql:url initParameter="dbURL"/>
<sql:driver initParameter="mysqlDriver"/>
<sql:userId initParameter="dbUserId"/>
<sql:password initParameter="dbPassword"/>
</sql:connection>
<sql:statement id="stmt1" conn="connectionMainDatabase">
<sql:query>
SELECT * FROM tplatby,tzpusobplatby WHERE tplatby.zpusobplatby_Id=tzpusobplatby.zpusobplatby_Id AND stravnik_Id=<sql:escapeSql><sess:attribute name="userID"/></sql:escapeSql>
</sql:query>
<table width="100%" class="tableDataShow" border="2">
<tr class="smallBoldTitle">
<td>datum</td>
<td>čas</td>
<td align="left">způsob platby</td>
<td align="right">částka</td>
</tr>
<sql:resultSet id="rset1">
<tr class="mouseOutRow" onmouseover="bgset(this)" onmouseout="bgunset(this)">
<td><sql:getColumn colName="datumPlatby"/></td>
<td><sql:getColumn colName="casPlatby"/></td>
<td align="left"><sql:getColumn colName="zpusobPlatbyTxt"/></td>
<td align="right"><sql:getColumn colName="castka"/></td>
</tr>
</sql:resultSet>
</table>
<sql:wasEmpty>
<div class="textGrey"><p><img src="img/warning.gif" alt="warn" align="middle"> Litujeme, ale nemáte zadané žádné platby.</p></div>
</sql:wasEmpty>
</sql:statement>
<sql:closeConnection conn="connectionMainDatabase"/>


My SQL dumb file:
SET FOREIGN_KEY_CHECKS=0;
use testovacidatabaze;
#----------------------------
# Table structure for tzpusobplatby
#----------------------------
CREATE TABLE `tzpusobplatby` (
`ZpusobPlatby_Id` tinyint(4) NOT NULL auto_increment,
`ZpusobPlatbyTxt` varchar(20) NOT NULL default '',
`ZpusobPlatbyPoznamka` varchar(250) default NULL,
`ZpusobPlabtyHotovost` tinyint(2) NOT NULL default '0',
PRIMARY KEY (`ZpusobPlatby_Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Zpusob platby';
#----------------------------
# Records for table tzpusobplatby
#----------------------------

insert into tzpusobplatby values
(1, 'Hotovost', null, 1),
(2, 'Faktura', null, 2),
(3, 'Převod zůstatku', null, 3);

Options: ReplyQuote


Subject
Written By
Posted
JSP + MYSQL wrong chars
April 19, 2005 03:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.