developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 14 years ago

Closed 12 years ago

#97 closed bug (fixed)

Database connector don't use charset of the app

Reported by: laurentj Owned by:
Priority: normal Milestone: Jelix 1.0beta2
Component: jelix:db Version: 1.0 beta1
Severity: major Keywords: db charset
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

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 (1)

patchMysqlCharset.diff (737 bytes) - added by sylvain261 12 years ago.
SET NAMES à la place de SET CHARACTER SET

Download all attachments as: .zip

Change History (5)

comment:1 Changed 14 years ago by laurentj

  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 12 years ago by sylvain261

  • Documentation needed unset
  • Resolution fixed deleted
  • review set to review?
  • Status changed from closed to reopened

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.

Changed 12 years ago by sylvain261

SET NAMES à la place de SET CHARACTER SET

comment:3 Changed 12 years ago 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).

comment:4 Changed 12 years ago by laurentj

  • Resolution set to fixed
  • Status changed from reopened to closed

landed in the trunk.

Note: See TracTickets for help on using tickets.