EllisLab text mark
Advanced Search
     
Charset Encoding / Double Byte Char Support
Posted: 22 December 2008 01:13 PM
Joined: 2007-12-31
14 posts

I have done a few search on this issue with no luck. Maybe someone can provide me some insight into this issue. I have used CodeIgniter to provide an web interface to an desktop application.
For whatever reason I can get the right Charset Encoding to allow Double Byte Character to display correctly in the web app and the desktop app.

For an example if I use the following text in both apps: :特别是形声字 与简体字无关 this is what I see in the database via phpmyadmin for each app.

the desktop app produces: 特别是形声字 ä¸Žç®€ä½“å­—æ— å…³
while the web app produces:

特别是形声字 ä¸Žç®€ä½“å­—æ— å…³ 

I’ve been told that the desktop app is use utf-8 but I can 100 percent confirm that original developer of the app is no longer with the company. However when using mb_detect_encoding() on the strings created by the desktop app
it report utf-8 for those strings and string created by the web app are reporting ASCII- however use something like iconv to try to go from ASCII to utf-8 with no luck.

I have made sure that my database (mysql) is setup for utf-8, i have the correct meta tab in my header <meta http-equiv=“Content-Type” content=“text/html;charset=utf-8” />, I have all of the CodeIgniter setting for Charset/Encoding set to utf-8, I have tried utf8_encode with no luck.

I’m not sure what the next steps should be or how to continue to troubleshoot this issue? Any suggest would be greatly appreciated.

bnewton

 
Posted: 06 January 2009 03:20 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2007-03-26
26 posts

i have the exact SAME problem…and it’s REALLY annoying.

if i don’t use code igniter…and write everything from stratch…and copy and paste in text from a email into a text box and submit the text box and have it inserted into a database i have no encoding/charet problem showing funky characters…..like such 特别是形声字 ä¸Žç®€ä½“å­—æ— å…³....

i only get this problem with code igniter…and both my mysql tables CI config files, CI DB config files, and html views are set to UTF-8…..i don’t know where in CI or why CI is this happening.

 Signature 

I’d rather be a failure at something I enjoy than a success at something I hate

 
Posted: 06 January 2009 05:04 PM   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-12-31
14 posts

Well I was able to finally resolved this issue for my situation. To be able to share data with the other app I was working with I need to change the following to latin1.

config.php
$config[‘charset’] = “latin1”;

database.php
$db[‘some_db’][‘char_set’] = “latin1”;
$db[‘some_db’][‘dbcollat’] = “latin1_swedish_ci”;

Everything else in my app uses UTF-8.

A tip that I got from a friend on this issue - is to use mysql via the command line to test your Encoding.

You can quickly test , character set, character collation, setting there - if you are getting the data from mysql.

regards,
bnewton