Reputation: 4383
I get the contents of a web page by curl, with charset set to Windows-1256.
Now I want to insert this data into a MySQL database, with charset utf8_general_ci.
Is there any way to do this?
Upvotes: 4
Views: 4504
Reputation: 88647
You need iconv()
:
$utf8 = iconv('windows-1256', 'utf-8', $win1256);
...although Supported character sets depend on the iconv implementation of your system.
, so YMMV.
If you want a 100% safe, works everywhere way to do this, the simplest thing to do would be to make a lookup table a use str_replace()
.
Upvotes: 8