Welcome Guest, Not a member yet? Register   Sign In
BUG: UTF-8 does NOT work!
#11

[eluser]Vasu Adiga[/eluser]
As you mentioned, when I use utf8 decode it throws up garbage. I used this to decode the data.

For others, I have stored hindi unicode data using java application in mysql db (4.x). See example patrika. Does mysql version have anything to do with this issue? Any help in this regard is appreciated. I use codeigniter 1.7.2 and notepad++.


[quote author="AzizLight" date="1270483951"]I didn't resolve the issue...

I just retrieved what I needed using MySQLi, it's the only solution I found. Until I find a real solution I'm not using CodeIgniter for client projects anymore.[/quote]
#12

[eluser]Vasu Adiga[/eluser]
Got it fixed. 3 potential causes:

1) Old version (4.x) of mysql db: Upgraded to the latest version (5.x) of mysql db.

2) The data was being inserted by a java application using jdbc/odbc connector. Changed connector to Connector/J. Reinserted all data.

3) Changed mysql db and table collation from utf8_general_ci to utf8_unicode_ci

No other changes or tweaks.

[quote author="Vasu Adiga" date="1270485196"]As you mentioned, when I use utf8 decode it throws up garbage. I used this to decode the data.

For others, I have stored hindi unicode data using java application in mysql db (4.x). See example patrika. Does mysql version have anything to do with this issue? Any help in this regard is appreciated. I use codeigniter 1.7.2 and notepad++.
#13

[eluser]Matthieu Fauveau[/eluser]
This is not a bug. I've made a lot of UTF-8 apps and I'm not encountering the problem.

You should change the title of your post.
#14

[eluser]tanero[/eluser]
I think there is no utf-8 problem with codeigniter. This related to mysql charset problem. Second application insert's data to mysql db other than utf-8 , but your codeigniter db connection is utf-8.

I have created 5 project with codeigniter , I haven't seen any utf-8 problem.
#15

[eluser]Mojtaba[/eluser]
Hi AzizLight,
I had an issue like yours, I mean everything is set right but the data fetched from db isn't in appropriate style. As Vasu Adiga declared, it doesn't work if you have inserted the data by a java application or maybe sth like that. Instead you need to insert the data yourself by ci queries, scaffolding feature or even by phpMyAdmin, then fetch them. It worked for me.
Although I found the solution but I don't know what the deal with the previous data was. I need to insert all data again.
#16

[eluser]Buso[/eluser]
[quote author="AzizLight" date="1267563924"]
Can anyone confirm what I am saying, and help me solve the problem please?[/quote]
no, sorry.. I always used utf-8 and never had a problem with CI
#17

[eluser]InsiteFX[/eluser]
The problem is the MySQL database, here is an example.

Create a new database with phpMyAdmin called test

Set the database collation to utf8_unicode_ci

Click create

Now you would think that that the database wa created with utf8_unicode_ci WRONG!

Now click on the top orerations tab and look at the collation on the bottom
it is set to latin1_swedish_ci

To fix it click the dropdown and change it to utf8_unicode_ci and click go.

Problem solved.

InsiteFX
#18

[eluser]MNG GHOST[/eluser]
[quote author="Buso" date="1273345257"][quote author="AzizLight" date="1267563924"]
Can anyone confirm what I am saying, and help me solve the problem please?[/quote]
no, sorry.. I always used utf-8 and never had a problem with CI[/quote]

Hi all,

I am newbie to Codeigniter so I faced same problem with UTF-8 where using Persian string to insert into database. At first I got something wrong output. But after checking my file headers I have missed header issue. e.g.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

This line of code solved all utf-8 unicode text.

Thanks,
Nasir Gulzade
#19

[eluser]Unknown[/eluser]
I've found a solution to a similar problem. I've tried setting headers and adding meta, none of it solved the problem.

Change dbcollat to none. This is what works for me.

Code:
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = '';
#20

[eluser]Unknown[/eluser]
[quote author="AzizLight" date="1267563924"]
Can anyone confirm what I am saying, and help me solve the problem please?
[/quote]

Well, I have struggled with the same problem a day or two - and solved it! However, it might be that we had the same symptoms for different problems.

I have tried to follow http://philsturgeon.co.uk/news/2009/08/U...odeIgniter but it didn't help me.

I traced the problem to the loading of data to a mysql server from a local SQL-source file. The trick, for me, is to explicitly start my local mysql terminal program with the flag --default-character-set=utf8 when loading the data to the web server. Something like this:

Code:
terminal> mysql --default-character-set=utf8  -u user -h host -p < source.sql

More info at:
http://dev.mysql.com/doc/refman/5.0/en/b...mands.html

n.b. Code Igniter apparently handles UTF8 fine Wink ... for me and my Swedish "dots"




Theme © iAndrew 2016 - Forum software by © MyBB