PHP: No mapping for the Unicode character..., for specific greek characters
I have a windows IIS server working with PHP. The user inserts a word via an HTML form, it goes to PHP and then PHP calls a COM dll (vb6) function passing the word to the function as a utf8 string.
Everything goes fine, until an input contains capital Greek letters with dialytika such as http://unicode-table.com/en/03AA/
When that happens, a PHP warning comes telling me: [07-Jul-2016 14:15:50 Europe/Athens] PHP Warning: Unknown: Could not convert string to unicode: No mapping for the Unicode character exists in the target multi-byte code page.
and a different scrambled string passes.
for example, the word μαϊου
will work fine but the word μαΪου
will produce the warning.
here is what the .dll function sees in both cases:
I tried playing with php settings a bit, but nothing changed. Current settings for php.ini (the ones I changed from default to the following ones - but still nothing):
default_charset = "utf-8"
com.code_page="utf-8"
mbstring.internal_encoding = UTF-8
I'm not sure what I must do to fix this issue. Thank you in advance for any insight.
Solution 1:
I resolved this by specifying the codepage when instantiating the com object. I could never get it working using the php.ini com.code_page directive. Try using:
$com = new COM("object name", NULL, CP_UTF8);