View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - UTF8 on display, wrong in database because twice converted (solved) - Page 3 - ProjeQtOr
 
 

UTF8 on display, wrong in database because twice converted (solved)

More
12 Jun 2014 12:00 #13 by Jean-Luc
I confirm a fonctional difference between MySqli and PDO (used by Projeqtor but buy no other software on my server nor my local PC), this one requering an extra parameter..

So I success to “repare” Projector by adding this line:
$cnx->query("SET NAMES utf8");
before line 66 in Sql.php which was
$result = $cnx->query($sqlRequest);
Immediately Projeqtor displayed exactly same bad strings as PhpMyAdmin and others, and correcting in the interface puts good characters in the base. :)

But this is not proper. Could you give me where set the NAMES value ? (still not found on the web, I continue to search, but…)
The topic has been locked.
More
12 Jun 2014 12:58 #14 by babynus
Here are my findings
[client]
default-character-set=utf8

[mysql]
default-character-set=utf8


[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
Take care that some parameters may work or not depending on mysql version
For instacne default-character-set seems to be obsolete in latest versions.

Babynus
Administrator of ProjeQtOr web site
The topic has been locked.
More
12 Jun 2014 14:13 #15 by babynus
Workaround could be to add
self::$connexion->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
after line 257 in Sql.php
so that it looks like this :
if (self::$dbType == "mysql") {
      ini_set('mysql.connect_timeout', 10);
    }
    try {
    	$dsn = self::$dbType.':host='.self::$dbHost.';port='.self::$dbPort.';dbname='.self::$dbName; 	  
    	self::$connexion = new PDO($dsn, self::$dbUser, self::$dbPassword);
    	self::$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    	// Could solve some erroneous default storing in non utf8 format
    	self::$connexion->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
    }
Will not be generalized as it can lead to wrong display on existing running instances.

Babynus
Administrator of ProjeQtOr web site
The topic has been locked.
More
12 Jun 2014 14:51 - 12 Jun 2014 14:52 #16 by Jean-Luc
self::$connexion->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
don’t work on my installation.

But Replacing that line by
self::$connexion->query("SET NAMES utf8");
(without quotes around 'utf8') works fine !

Problem solved, but PDO need to be documented in installation procedure :
– as it is required (install if not)
– patch in Sql.php module.

Therefore I understand that the « new » problem of wrong display in existing instances is only due to that I've detected was there and active, but without acces other than Projeqtor tools, remains hidden.
Database tables can probably be repaired with global export (before patch) then reimport after patch.
Last edit: 12 Jun 2014 14:52 by Jean-Luc.
The topic has been locked.
More
05 Aug 2014 18:12 #17 by Jean-Luc
After migration to v4.4, flag 'enforceUTF8' is not set because existing, but need because UTF8 already enforced.
So I have commented the condition “if (isset($enforceUTF8) and $enforceUTF8)”.
But the proper method is to set the flag. Where to define it ?
The topic has been locked.
More
05 Aug 2014 18:42 #18 by babynus
Just define it in parameters.php file
$enforceUTF8=true;

Babynus
Administrator of ProjeQtOr web site
The topic has been locked.
Moderators: babynusprotion
Time to create page: 0.041 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.