ICONV: curl special or weird character issue solution in php

by rajesh 2014-05-13 20:40:34

This might be a solution for certain cases of special character or weird charcters when using curl.
 
$str = iconv(“UTF-8″,”Windows-1252″,$str);

use the iconv function to convert the charset from windows-1252 to utf8.

Chars like single quotes that are shown as special charcters will be replaced by the above function.

This still may cause issue as such characters cannot be replaced using str_replace.
We can remove such character by using the iconv function again as
 
$str = iconv("UTF-8", "UTF-8//IGNORE", $str);
1265
like
0
dislike
0
mail
flag

You must LOGIN to add comments