$converted = iconv("windows-1256", "UTF-8", $text PHP: You'll need to have that extension installed though.
i've tryed this, but it doesen't work... i'm using xampp, and the extension iconv is installed defaultly.. when i check phpinfo(), i got this result: iconv support : enabled iconv implementation : "libiconv" iconv library version : 1.11 Directive Local Value Master Value iconv.input_encoding ISO-8859-1 ISO-8859-1 iconv.internal_encoding ISO-8859-1 ISO-8859-1 iconv.output_encoding ISO-8859-1 ISO-8859-1 any idea?
What doesn't work? Do you receive an error? Obviously there was a mistake in my code (forgot the ");" at the end) Are you sure your input text is in fact windows-1256 encoded? etc.
no i don't receive any error, but the converted text has only unreadable charachter... yes i'm sure that the original text is "windows-1256", i'm trying to get some inforamtion from my forum (it's vbulletin), and to post it on my front site (it's a utf-8)...
i've tryed it.. but it doesen't work... i'm getting string from the database of a vbulletin forum (the vbulletin data base is windows-1256) and i want to convert it to utf-8 i've tried this : $forumname_utf = mb_convert_encoding($forumname,"utf-8"); PHP: but also, it doesen't work.. i'm not getting any error, but the string is not converted correctly.. ÇáÃæÑÉ ÇáËÞÇÃÃÉ ÇáÔÈÇÈÃÉ Code (markup):
You need to specify the third parameter as well. Was vbulletin (the script) set up correctly to work with windows-1256 or was it still using utf-8?
what is the third parameter ("windowd-1256")?? i've tried this $forumname_utf = mb_convert_encoding($forumname,"utf-8","windows-1256"); PHP: result: ÇáÃæÑÉ ÇáËÞÇÃÃÉ ÇáÔÈÇÈÃÉ Code (markup): and i've tried this $forumname_utf = mb_convert_encoding($forumname,"windows-1256","utf-8"); PHP: but there's not result...
I would think just converting the entire database would be a better idea than trying to do this on the fly. A script like this may be helpful: http://yoonkit.blogspot.com/2006/03/mysql-charset-from-latin1-to-utf8.html Just remember though: Backup first in case something goes wrong.
Two things to insure: 1) Are you doing database transfer? If so, try adding this mysql option before iconv after connecting to each database: mysql_query("SET NAMES `utf8`); And for the Arabic database mysql_query("SET NAMES `cp1256`); 2) If you are echoing the data to the page - to actually see the result, insure that the page is in the following format: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> Final Arabic text. </body> </html> Code (markup):
i'm not trying to transfer the database... my web site encoding is "utf-8", and i'm trying to integrate it with my forum it's Vbulletin... the problem is that Vbulletin use the encoding "windows-1256", so the information getted from the vbulletin is bad displayed in my site... i've tryied to change the database encoding but it cause a lot of error... also the database will be larger because utf-8 is using 2 byte for each charachter... i've tried to use the mb_convert_encoding and the iconv functions, but also it doesen't work.. any one can help me to solve the problem???