UTF-8 characters

roberto
2012-11-01
2013-05-28
  • roberto
    roberto
    2012-11-01

    Hi all,
    I've got a lot of troubles with non LATIN characters; essentially what happens is that in the DB words are written correctly but in the front-end nothing appears.
    For the installation of Refbase I've followed the 'manual installation' setup procedure.
    The variables in DB are set as follows:
    character set client utf8
    character set connection utf8
    character set database utf8
    collation connection utf8_general_ci
    collation database utf8_general_ci
    collation server utf8_general_ci

    I've already looked at the 'http://www.refbase.net/index.php/Troubleshooting' but it doesn't help.

    Chars as: ' í ' , ' ü ' , ' é ' … and many others are simply ignored by the php pages of the front-end, even if present in DB

    could someone please help me?
    best regards

     
  • roberto
    roberto
    2012-11-03

    Hello, nobody has an idea?

     
  • What is the setting of $contentTypeCharset in initialize/ini.inc.php?  Did the files on the server get saved as UTF-8? 

     
  • roberto
    roberto
    2012-11-03

    $contentTypeCharset = "UTF-8";
    encoding of the file Unicode(UTF-8)

    I think I found a troubleshooting at http://pureform.wordpress.com/2008/03/23/make-your-website-completely-utf-8-friendly/  and specially in

    <?php
        mysql_query("SET NAMES 'utf8'");
        mysql_query("SET CHARACTER SET utf8");
    ?>
    

    I've developed a custom PHP page writing directly into refs table, and the result was the same as decribed in my previous post, when I changed the code as above, troubles were suddenly solved…

    but the fact is that mysql_query statement is never used in Refbase….

     
  • Sure it is.  In the queryMySQLDatabase function in includes/include.inc.php

     
  • roberto
    roberto
    2012-11-03

    SOLVED! thanks
    inserted into includes/include.inc.php
    the two lines
        mysql_query("SET NAMES 'utf8'");
        mysql_query("SET CHARACTER SET utf8");
    but why was not embedded in originary code?

     
  • These are typically set in mysql.ini file for UTF-8 native versions of MySQL.  It typically isn't needed.  But I'll look into whether it would hurt things to add them.

     
  • When using MySQL 4.1 or greater with variable '$contentTypeCharset' (file 'initialize/ini.inc.php') being set to "UTF-8", refbase actually calls

    mysql_query("SET NAMES utf8")
    

    in function 'connectToMySQLDatabase()' (file 'includes/include.inc.php'). However, it doesn't yet call

    mysql_query("SET CHARACTER SET utf8")
    

    So maybe we should add this as well. For newer PHP versions, we should probably use 'mysql_set_charset()' instead.

    Matthias