Ticket #97 (closed bug: fixed)

Opened 1 year ago

Last modified 2 months ago

Database connector don't use charset of the app

Reported by: laurentj Assigned to:
Priority: normal Milestone: Jelix 1.0beta2
Component: jelix:db Version: 1.0 beta1
Severity: major Keywords: db charset
Cc: Php version:
Review: review+ Hosting Provider:
Documentation needed: 0 Blocking:

Description

The charset used in database connection is the one indicated in the client configuration (mysql configuration for example), and not the one indicated in a jelix application configuration. So datas returned by a query may be not in the correct charset.

For mysql for example, a query like "SET CHARACTER SET 'utf8'" should be executed after the connection.

The problem appears with mysql driver, pdo and probably postgresql driver.

Attachments

patchMysqlCharset.diff (0.7 kB) - added by sylvain261 on 04/29/08 10:07:47.
SET NAMES à la place de SET CHARACTER SET

Change History

01/24/07 00:46:35 changed by laurentj

  • status changed from new to closed.
  • resolution set to fixed.

04/29/08 10:06:54 changed by sylvain261

  • status changed from closed to reopened.
  • resolution deleted.
  • review set to review?.
  • docneeded changed.
  • blocking changed.

Dans la doc Mysql on a :
A SET NAMES 'x' statement is equivalent to these three statements:
SET character_set_client = x;
SET character_set_results = x;
SET character_set_connection = x;

Setting character_set_connection to x also sets collation_connection to the default collation for x.

SET CHARACTER SET is similar to SET NAMES but sets the connection character set and collation to be those of the default database. A SET CHARACTER SET x statement is equivalent to these three statements:
SET character_set_client = x;
SET character_set_results = x;
SET collation_connection = @@collation_database;


Pour faire propre et ne pas dépendre la la collation de la base par défaut de mysql il convient donc de faire un SET NAMES et non pas un SET CHARACTER SET. J'attache le patch correspondant de ce pas.

04/29/08 10:07:47 changed by sylvain261

  • attachment patchMysqlCharset.diff added.

SET NAMES à la place de SET CHARACTER SET

05/04/08 23:23:56 changed by laurentj

  • review changed from review? to review+.

à commiter sur le trunk et la branche 1.0.x.

La prochaine fois, créer un nouveau ticket, et ne réouvre pas comme ça de vieux tickets, qui n'ont finalement pas grand chose à voir. (je ne réouvre pas le ticket sur la creation de jforms à chaque fois que je vais faire une évolution ou une correction sur jforms).

05/20/08 18:41:05 changed by laurentj

  • status changed from reopened to closed.
  • resolution set to fixed.

landed in the trunk.

Download in other formats: Comma-delimited Text Tab-delimited Text RSS Feed