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

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
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:

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:statement id="stmt1" conn="connectionMainDatabase">
SELECT * FROM tplatby,tzpusobplatby WHERE tplatby.zpusobplatby_Id=tzpusobplatby.zpusobplatby_Id AND stravnik_Id=<sql:escapeSql><sess:attribute name="userID"/></sql:escapeSql>
<table width="100%" class="tableDataShow" border="2">
<tr class="smallBoldTitle">
<td align="left">způsob platby</td>
<td align="right">částka</td>
<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>
<div class="textGrey"><p><img src="img/warning.gif" alt="warn" align="middle"> Litujeme, ale nemáte zadané žádné platby.</p></div>
<sql:closeConnection conn="connectionMainDatabase"/>

My SQL dumb file:
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`)
# 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

Written By
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.