List:Eventum Development« Previous MessageNext Message »
From:Bryan Alsdorf Date:March 7 2005 9:24am
Subject:Re: Using multi-byte characters
View as plain text  
Hi,

I have been doing a lot of investigation into your email, and I finally 
found a solution. You should do a lot of reading about how MySQL handles 
charsets, particularly 
http://dev.mysql.com/doc/mysql/en/charset-connection.html

First off, my test database is MySQL 4.1. The default character set is 
utf8 and I set the table and column to be utf8 as well.

You will need to make sure your browser is set to utf8. If you set 
APP_CHARSET in config.inc.php to be utf8 this should send the correct 
header.

You will need to make sure the following 2 queries are issues for each 
connection to the database. You can modify include/class.db_api.php to 
do this. The queries are:

SET CHARACTER SET utf8;
SET NAMES 'utf8';

This will make sure the connection is sending utf8 encoded data instead 
of converting it.

The last step is to run utf8_encode 
(http://us2.php.net/manual/en/function.utf8-encode.php) on the data 
before you insert it into the database.

As you can see, this is not a simple process. If you decide to go 
through with it, please let me know how it goes. Hopefully in the future 
  we will be able to make Eventum work strictly in utf8 so things will 
work easily.

Best Regards,
/bryan


Shuichi Tamagawa wrote:
> Hi Bryan, 
> 
> Here is the test result.
> 
> 
>>1. Print out the data as soon as it is submitted. You can do 
>>this by adding var_dump($_POST); to new.php.
> 
> 
> If I see the test result on the browser, the character is still intact here.
> If I show the source of the result page, however, it is converted to NCR like...
> 
> ["summary"]=>
> string(8) "あ"
> ["description"]=>
> string(8) "あ"
>  
>  
> 
>>2. Print out the data immediately before it is inserted. You 
>>will need to edit include/class.issue.php, the insert() 
>>method, about line 1665.
> 
> 
> The same as above.
> 
> It seems that the character is already converted at the point 1.
> 
> 
>>Let me know if the character is still intact at both of those places.
>>
>>Regards,
>>/bryan
>>
>>Shuichi Tamagawa wrote:
>>
>>>Hi
>>>
>>>I'd like to use multi-byte characters for the data of issue records.
>>>
>>>It seems that, however, Eventum converts the multi-byte 
>>
>>characters to 
>>
>>>Numeric Character Reference to Unicode when the data is 
>>
>>submitted and 
>>
>>>store to the database as a 'string' of NCR.
>>>
>>>As a result, the multi-byte characters are not displayed correctly.
>>>
>>><Example>
>>>1. The character submitted from Eventum screen(JAPANESE 
>>
>>HIRAGANA LETTER A). 
>>
>>>あ
>>>
>>>2. The character in the database
>>>&#12354;
>>>
>>>3. The character displayed after retrieving &#12354;
>>>
>>>4. HTML source after retrieving the character &amp;#12354;
>>>
>>>How can I store the multi-byte characters to the database as is 
>>>without converting to NCR?
>>>
>>>--
>>>Shu
>>>
>>>
>>>
>>
>>--
>>Bryan Alsdorf, Software Engineer
>>MySQL AB, www.mysql.com
>>
>>Are you MySQL certified?  www.mysql.com/certification
>>
>>--
>>Eventum Developers Mailing List
>>For list archives: http://lists.mysql.com/eventum-devel
>>To unsubscribe:    
>>http://lists.mysql.com/eventum-devel?unsub=1
>>
> 
> 
> 

-- 
Bryan Alsdorf, Software Engineer
MySQL AB, www.mysql.com

Are you MySQL certified?  www.mysql.com/certification
Thread
Using multi-byte charactersShuichi Tamagawa14 Feb
  • Re: Using multi-byte charactersBryan Alsdorf23 Feb
    • RE: Using multi-byte charactersShuichi Tamagawa28 Feb
    • RE: Using multi-byte charactersShuichi Tamagawa28 Feb
      • Re: Using multi-byte charactersBryan Alsdorf7 Mar
        • RE: Using multi-byte charactersShuichi Tamagawa9 Mar