Tracker: Bugs

5 UTF-8 and language.inc.php - ID: 3072777
Last Update: Comment added ( holbi )

I'have some problems with the language_files.
- now, my gui_fr.langprop file begin with //
//
_jotl.language.encoding=UTF-8

- I'have changed the language.inc.php in line 32. I'm testing the $strLine like this if ($strLine) { if ( ($strLine[0] != "#") ...
- 'have changed the mail_content_values.php in line
- 574 : echo $arrSlot['strName']; => echo htmlentities(utf8_decode($arrRow["strName"]));
- 586 : htmlentities($arrRow["strName"]) => htmlentities(utf8_decode($arrRow["strName"]))

And now, everything work.


Cyril Chable ( marshmallow007 ) - 2010-09-21 09:28:41 PDT

5

Open

None

Nobody/Anonymous

Managing interface

V.2.12.0

Public


Comment ( 1 )

Date: 2010-12-31 11:10:05 PST
Sender: holbi

Hello Cyril,

Please try your solution with letters őŐ and űŰ, will not work.
The reason of UTF-8 problems was the unset of character set of SQL
connections.

In the file ...\config\db_connect.inc.php the MySQL connection character
set is not set properly.
The connection with the default settings (to the proper UTF-8 database)
usually are the following:

array(2) { ["Variable_name"]=> string(20) "character_set_client"
["Value"]=> string(6) "latin1" }
array(2) { ["Variable_name"]=> string(24) "character_set_connection"
["Value"]=> string(6) "latin1" }
array(2) { ["Variable_name"]=> string(22) "character_set_database"
["Value"]=> string(4) "utf8" }
array(2) { ["Variable_name"]=> string(24) "character_set_filesystem"
["Value"]=> string(6) "binary" }
array(2) { ["Variable_name"]=> string(21) "character_set_results"
["Value"]=> string(6) "latin1" }
array(2) { ["Variable_name"]=> string(20) "character_set_server"
["Value"]=> string(4) "utf8" }
array(2) { ["Variable_name"]=> string(20) "character_set_system"
["Value"]=> string(4) "utf8" }

It is the reason why so many posts on the CuteFlow forum about the
character set mismatch. Latin1 does not accept for example Ő and Ű
letters.

The instant solution is to add only one line to the
...\config\db_connect.inc.php
Ref: http://hu2.php.net/manual/en/function.mysql-set-charset.php

<?php
$connection = @mysql_pconnect($DATABASE_HOST, $DATABASE_UID, $DATABASE_PWD)
or die("Cant connect to database -A");

mysql_query("SET character_set_results = 'utf8', character_set_client =
'utf8', character_set_connection = 'utf8', character_set_database = 'utf8',
character_set_server = 'utf8'", $connection);

$db = @mysql_select_db($DATABASE_DB, $connection)
or die("Cant connect to database -B");

?>

The connections are set properly after executing this command:

array(2) { ["Variable_name"]=> string(20) "character_set_client"
["Value"]=> string(4) "utf8" }
array(2) { ["Variable_name"]=> string(24) "character_set_connection"
["Value"]=> string(4) "utf8" }
array(2) { ["Variable_name"]=> string(22) "character_set_database"
["Value"]=> string(4) "utf8" }
array(2) { ["Variable_name"]=> string(24) "character_set_filesystem"
["Value"]=> string(6) "binary" }
array(2) { ["Variable_name"]=> string(21) "character_set_results"
["Value"]=> string(4) "utf8" }
array(2) { ["Variable_name"]=> string(20) "character_set_server"
["Value"]=> string(4) "utf8" }
array(2) { ["Variable_name"]=> string(20) "character_set_system"
["Value"]=> string(4) "utf8" }

We have to add this blue line for the setup of MYSQL connection charset
into the all files which handle SQL data-stream - about 70 items in 54-55
files.

It would be nice to declare an SQL data class for the next release to make
more simple code with proper character set of SQL connections.



Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.