List:MySQL and Java« Previous MessageNext Message »
From:Abo Pignard Date:August 7 2004 12:23pm
Subject:Re: Character encoding.
View as plain text  
Hello Igor, thanks for your answer.

It seems to have the same behaviour with this setting.

		Best regards, Pascal.
		http://perso.wanadoo.fr/blady


Le 5 août 04, à 13:15, Igor Smirnov a écrit :

> Try setting "unicode" in the connection string: "setUnicode=true"
>  
> Hope it helps
>
> Abo Pignard <abo.pignard@stripped> wrote:
> Hello,
>
> I use an MySQL 4.1.2 database server.
> I execute Java queries with the connector 3.1.2.
>
> As described in MySQL documentation the defaut caracter encoding is
> latin1 or ISO8859_1:
> CREATE TABLE `editeurs` (
> `ns` int(11) unsigned NOT NULL auto_increment,
> `nom` char(40) default NULL,
> PRIMARY KEY (`ns`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1
>
> Command line : UPDATE `editeurs` SET `nom`="Denoël" WHERE `ns` = "10"
> (second e with umlaut, ë in html convention)
>
> When I read a string with accent, I get the good ones :
> public String getEditeurs(String val) throws SQLException {
> String editeur = null;
> ResultSet res = stmt.executeQuery(
> "select nom"
> + " from editeurs"
> + " where upper(nom) like \"%" +
> val.toUpperCase()
> + "%\";");
> if (res != null)
> while (res.next()) {
> editeur = res.getString("nom");
> }
> if (res != null) res.close();
> return editeur;
> }
>
> => Denoël : good e with umlaut.
>
> But when I write a string with accent I got wrong caracter when I read
>  it again:
> public int createEditeurs(String nom) throws SQLException {
> return stmt.executeUpdate(
> "insert into editeurs (nom)"
> + " values (\""
> + nom
> + "\");");
> }
>
> => Deno‘l : bad caracter
>
> Is there some configuration variable to set either in MySQL server or
> on J-Connector?
>
> Thanks in advance for your answers.
>
> Best regards, Pascal.
> http://perso.wanadoo.fr/blady
>
> PS : I home you will read the accent in my e-mail.
>
>
> Do you Yahoo!?
>  Yahoo! Mail is new and improved - Check it out! 
Thread
Character encoding.Abo Pignard4 Aug
Re: Character encoding.Abo Pignard7 Aug
  • Re: Character encoding.Abo Pignard30 Aug
    • Re: Character encoding.Igor Smirnov31 Aug
      • Re: Character encoding.Abo Pignard2 Sep
        • Re: Character encoding.Mark Matthews2 Sep