Php Arabic character set encoding

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
bisharbn
Forum Newbie
Posts: 4
Joined: Sun Jan 15, 2012 6:01 am

Php Arabic character set encoding

Post by bisharbn »

I need to display data from a table (which is arabic data) from sharepoint (sql server 2008) usng php. when i tried this its showing question mark.
I had declared the character set as UTf-8 and also tried iconv to convert the data to utf-8 but the result ??????how can i solve this? :banghead: Any reply is appreciated.Thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Php Arabic character set encoding

Post by Christopher »

I assume when you say "declared the character set as UTf-8" that you mean you have set the character encoding for the HTML page to UTF-8. Are you sure that you have done this correctly? Are you sure the data coming from the database is UTF-8?
(#10850)
bisharbn
Forum Newbie
Posts: 4
Joined: Sun Jan 15, 2012 6:01 am

Re: Php Arabic character set encoding

Post by bisharbn »

Thanks for the reply...yes I declared the html page character set as UTF-8.the data coming from database is UTF-8 ie (MS SQL Server DB).I retrieved the data and the content is arabic which is working fine when retrived in asp pages..where as ????????? question mark on php page.........I want to solve the issue which is in php pages.(question mark ????????) :(
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Php Arabic character set encoding

Post by Eric! »

Can you post some code showing us what you are doing? It is possible your database code is not encoding the strings properly. Or it could be that PHP is confused with the multibyte strings for UTF-8 and you need to use multibyte safe methods.
bisharbn
Forum Newbie
Posts: 4
Joined: Sun Jan 15, 2012 6:01 am

Re: Php Arabic character set encoding

Post by bisharbn »

Thanks for the reply...i'm fetching data from sharepoint server directly(sql server 2008) the data is arabic its saving direclty from sharepoint server...so i dont know what type of encoding is sharepoint using in saving the data ...
I didnt understand about mulitbyte string of UTF-8 ..can u pls explain or show an example..
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: Php Arabic character set encoding

Post by Vegan »

looks like the database may not be configured correctly
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
bisharbn
Forum Newbie
Posts: 4
Joined: Sun Jan 15, 2012 6:01 am

Re: Php Arabic character set encoding

Post by bisharbn »

Vegan wrote:looks like the database may not be configured correctly
But the same db is working fine in asp.net page ie the arabic is displaying...the question mark is shown only in php page...So it cant be concluded as the DB problem..
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Php Arabic character set encoding

Post by Eric! »

The database connection might not be the correct encoding. Take a look at this thread for ideas
viewtopic.php?f=2&t=132655

If it's not the database encoding or connection type, then look at php multibyte functions. Take a look at this page for help
http://developer.loftdigital.com/blog/p ... cheatsheet
Post Reply