I have a php file that reads a CSV file that im assuming is in UTF-8 - sent via API. I'm using fopen() to read it.
The issue is my output returns as :
IU?Q?JL?.?/Q?R??/)?J-.?))VH?/OM?K-NI?T0?P?*ͩT0204jzԴ?H???X???@ D??K
I checked my php5 config settings:
Default is UTF-8 already :/ ; php.net/default-charset ;default_charset = "UTF-8"
I changed ISO-8859-1 to UTF-8 below also:
[iconv] ;iconv.input_encoding = UTF-8 ;iconv.internal_encoding = UTF-8 ;iconv.output_encoding = UTF-8 ;mssql.charset = "UTF-8"
The output is still the same. Any suggestions or steps I could take to solve the issue.
I never opened files with php but,
Have you used
$data = fopen($file);
fgets($data);
, too?
If you are just reading from the source, no problem as php doesn't make any encoding assumptions for strings. So, if your source is sending you the data as UTF8, it is UTF8, the default_charset in php is just an header sent before your page which can be overridden in a number of ways. Check if your browser is actually showing the page in the correct encoding... in Chrome, go to the menu More Tools / Encoding, there you'll see the encoding that is being used.
I had to use compress.zlib to solve the issue $f_pointer=fopen("compress.zlib:URL","r");