CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Once again UTF-8...

Print topic Send  topic

Author Message
rickielee

Posts: 9
Posted: 03/17/2007, 8:53 AM

I tried to change all settings I could find to utf-8 but I still cannot post/save data correctly into mysql !!!

Input: Some special german characters in a text area /memo box in CCS application 1

Check: Mysql query builder shows only dummy chars for the corresponding record data in the DB

Output: CCS application 2 also show only dummy chars

Mysql tables are set correctly to utf-8 !

I did set to utf-8 the following server things:
project ->server/script->charset
project->locale&encodings->file encoding
project->locale&encodings->default html encoding
project->use international features (checked)
project->site locales(english)->output encoding

Also set to utf-8 the following page things:
page properties->encoding

I'm using CCS3.1, Mysql 4.1.21, PHP

Any idea?
Thanks
View profile  Send private message
rickielee

Posts: 9
Posted: 03/17/2007, 10:17 AM

I found out that somewhere the UTF-8 is not set correctly. Config/setting file !?!?

Instead of "UTF-8" it should be "UTF8"...

I tried adding a line of code to force UTF8 in "db_mysql.php" as follows and now it works.

if ($version[0] >= 4) {  
        if (($version[0] > 4 || $version[1] >= 1) && is_array($this->Encoding) && $this->Encoding[1])  
          @mysql_query("set character set '" . $this->Encoding[1] . "'", $this->Link_ID);  
        elseif (is_array($this->Encoding) && $this->Encoding[0])  
          @mysql_query("set character set '" . $this->Encoding[0] . "'", $this->Link_ID);  
      }  
@mysql_query("set character set 'UTF8'", $this->Link_ID);  
      $this->Connected = true;  

Any idea where the bug could be?
View profile  Send private message
ngrubelic

Posts: 12
Posted: 03/27/2007, 9:20 AM

Rickielee,

try this solution (works for me):

if ($version[0] >= 4) {
if (($version[0] > 4 || $version[1] >= 1) && is_array($this->Encoding) && $this->Encoding[1])
@mysql_query("set names 'UTF8'", $this->Link_ID);
elseif (is_array($this->Encoding) && $this->Encoding[0])
@mysql_query("set names 'UTF8'", $this->Link_ID);
}
$this->Connected = true;
}



Regards, Neven


Quote rickielee:
I found out that somewhere the UTF-8 is not set correctly. Config/setting file !?!?

Instead of "UTF-8" it should be "UTF8"...

I tried adding a line of code to force UTF8 in "db_mysql.php" as follows and now it works.

if ($version[0] >= 4) {  
        if (($version[0] > 4 || $version[1] >= 1) && is_array($this->Encoding) && $this->Encoding[1])  
          @mysql_query("set character set '" . $this->Encoding[1] . "'", $this->Link_ID);  
        elseif (is_array($this->Encoding) && $this->Encoding[0])  
          @mysql_query("set character set '" . $this->Encoding[0] . "'", $this->Link_ID);  
      }  
@mysql_query("set character set 'UTF8'", $this->Link_ID);  
      $this->Connected = true;  

Any idea where the bug could be?

View profile  Send private message
pdes

Posts: 3
Posted: 05/10/2007, 9:40 AM

Hey there,

that's not a bad hack! But there's a way to do that in a simpler way, as long as you're using PHP5.x.

Go to project settings, select server/script and set the encode extension to iconv. That will take care of that.

Right now I'm using it on a Ukrainian/English site that allows to enter text on both character sets (actually is all UTF8).

Keep in mind that when you look at the mysql data, the terminal that you're using needs to have the correct translation.

There's another encode extension (mb), but when I try to load my site with that one, nothing happens.

Good luck,

Pablo
View profile  Send private message
andrewi

Posts: 162
Posted: 12/12/2007, 3:02 AM

Using Oracle (10i) and CCS 3.1.
UTF-8 selected for site encoding.

Error:
Warning: ocilogon() [function.ocilogon]: Invalid character set name: UTF-8 in /data/www/citybond/docs/beta/andrew/ccs/branding/db_oci8.php on line 67

Related to the same issue of encoding code "UTF-8" not being recognised by Oracle.

FIXED following above advice by editing the encoding in Common.php to change UFT-8 to UTF8.
  
//Connection Settings @0-8244F1E9  
$CCConnectionSettings = array (  
    "cbond" => array(  
        "Type" => "Oracle",  
        "DBLib" => "OracleOCI",  
        "Database" => "CBOND",  
        "Host" => "",  
        "Port" => "",  
        "User" => "citybond",  
        "Password" => "citybond",  
        "Encoding" => "UTF8",  
        "Persistent" => false,  
        "DateFormat" => array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"),  
        "BooleanFormat" => array(1, 0, ""),  
        "Uppercase" => true  
    )  
);  
//End Connection Settings  

It seems OK to leave "UTF-8" in other areas of Common.php
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.