Hi!

I have a problem very funny:

I get my data from
<h:inputText value="#{blogBean.blogPage.title}"  />

I have in the header of my .xhtml like:
<?xml version="1.0" encoding="utf-8"?>

Now, I have Mysql 5.0.51a with

Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8

and the collation of the table "blog" like
utf8_unicode_ci

I have the all the data into the database with utf8 codification.

The problem is:

When I get the data from the input text I get a wrong text
with special characters, for example ó is substituted for ó.

Then when I store the data in the database I write the ó character.

The funny is that before I had this configuration:
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1

with the codification latin1 for all the database
and utf-8 codification for the .xhtml.

Now, with this configuration, when I get the data from the inputText
the data is stored correctly in the String variable and in the
database but when I
get the data from the database this is displayed wrong
(the same problem: ó is replaced by ó and etc when I get the data
with title= rs.getString("title"); )

I tried to configure the connection to use explicit character encoding
but this method fail, then I tried of get the data like

byte[] stringValue = rs.getBytes("title");
String str = new String(stringValue,"utf-8");

but fail too, I changue the codification to latin1, ISO..., etc but
always fails.

In resume, the funny is that with utf8 codification in all the
aplication the data is corrupted
when I get the data from inputtext and if the codification is latin1
in the db and utf8
in the aplication then fails when I get the data from the database.

Im using: Linux Debian Lenny, mysql 5.0.51a-24-log (Debian),
myfaces-impl-1.2.5.jar
and mysql-connector-java-5.1.5-bin.jar.

Thanks in advanced!

-- 
ItZtLi

Reply via email to