Page 1 of 1

v1.1.4 - still having problem with UTF-8 characters

Posted: Thu Feb 12, 2009 11:06 pm
by Blackbird
Hi, I'm new with OpenCart, and using it on my local machine.

I'm using the right to left UTF-8 language. I translated the language files and my translated characters show without any problem but when I want to insert a text (using UTF-8 characters) for example in the fields of register, after submit my text become like this: "?? ?? ? ??". (text: أهلا وسهلا)

also when I changing a values directly in the DB, they show correctly.

read some of the topics about this problem but none of them helped me. also I noticed that Daniel said he fixed this problem in v1.1.2 but I still have this problem.

any help will be appreciated
thanks

Re: v1.1.4 - still having problem with UTF-8 characters

Posted: Thu Feb 12, 2009 11:49 pm
by Daniel
try removing the response->addHeader(); in the index.php.

Let me know the result please.

Re: v1.1.4 - still having problem with UTF-8 characters

Posted: Fri Feb 13, 2009 12:30 am
by Blackbird
I removed this line in the index.php:

Code: Select all

$response->addHeader('Content-Type', 'text/html; charset=UTF-8');
and tested it again but nothing happened.

Re: v1.1.4 - still having problem with UTF-8 characters

Posted: Fri Feb 13, 2009 12:44 am
by Daniel
I think it might be somthing to do with the html special character function in the request class. I'm going to do some testing tonight.

Re: v1.1.4 - still having problem with UTF-8 characters

Posted: Fri Feb 13, 2009 12:04 pm
by jc
I had this problem too (http://forum.opencart.com/index.php/topic,3001.0.html).

Fix it by using language files in UTF8 without BOM (Byte Order Mark). BOM are 3 invisible characters in the head of UTF8 file which added by Windows Notepad. You can use Notepad++ or UltraEdit or any professional editor to save UTF8 without BOM.

Re: v1.1.4 - still having problem with UTF-8 characters

Posted: Fri Feb 13, 2009 4:47 pm
by Blackbird
As I said in the first post, language files display correctly. my problem appears when I want to insert a text to the DB.

I'm using Dreamweaver CS3 and always saving the files without BOM.

Re: v1.1.4 - still having problem with UTF-8 characters

Posted: Sat Feb 14, 2009 4:50 am
by Blackbird
OK, fixing this bug by changing the Collation of the opencart DB to "utf8_unicode_ci".

Go to: "phpmyadmin -> opencart DB -> Operations -> collation -> select: utf8_unicode_ci".

OR

Run this SQL query:
ALTER DATABASE `opencart_db_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci