I need help encoding a script to UTF8

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Recure
Forum Newbie
Posts: 1
Joined: Tue May 11, 2010 8:13 pm

I need help encoding a script to UTF8

Post by Recure »

Hi,

I bought the script Gen4 weeks ago, and after installing it I noticed that it does not support any added Arabic characters, they turn into symbols.

The problem was in my database too, but after changing the encoding of the database and all its tables from latin1 to utf8_general_ci, it got fixed, only on the database.

But the problem was still going in the script, when I type any Arabic word in the script from admin-panel it changes to symbols, and when I add Arabic words from the database it shows as question marks on the main page.

If you check my site right now (rb7net.net) you'll notice that the name of the site is showing as "RB7 ????"(four question marks instead of four Arabic letters.) I tried many ways but none of them worked, like:

1) changing the encoding of the database like I mentioned above

2) tried adding the following code to the file header.php in the theme folder

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3) used the program Rapid PHP Editor and changed the encoding of every single php file in the script to "UTF-8 without ROM"

---

I believe that the thing I'm missing is a code I should add to the config.php or db.php files. something like:

Code: Select all

set character_set_server='utf8'; set names 'utf8';
or

Code: Select all

<?php     mysql_connect($db_hostname, $db_username, $db_password);     mysql_query("set names 'utf8';");     // The rest of you php code! ?>
Thanks for taking the time to read such a long post and sorry for making it too long.

Thanks!
Recure.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: I need help encoding a script to UTF8

Post by Benjamin »

I believe you need to set this in the HTML as well.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: I need help encoding a script to UTF8

Post by klevis miho »

I have a similar problem. I've set <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> in the <head>
I've set the db to utf-8 via phpmyadmin.
And nothing works.
edaili
Forum Newbie
Posts: 3
Joined: Tue Oct 05, 2010 6:58 am

Re: I need help encoding a script to UTF8

Post by edaili »

Hello
Im having a similiar problem
I am trying to retrieve data from oracle into PHP and I have successfully accomplished that, but the data appeared in question marks (??????), so I add the AMERICAN_AMERICA.AR8MSWIN1256 to NLS language in the registry for oracle and now the data appears as (ÓÇãÑ ÝíáíÈ ÚíÏ ÇáÚÏíáí). I tried encoding and all suggested character sets from IE and from the PHP code but had no results. I tried Windows-1256, UTF-8 & 16, I would appreciate some support for this issue
By the way anything else in the page that is not generated from the database and written in arabic appears in arabic OK with no problems so i have no problem with that, only with what is generated from the database.
windows-1256 generates (ÓÇãÑ ÝíáíÈ ÚíÏ ÇáÚÏíáí)
UTF-8 generates (����� � ����� )
Thank you
Post Reply