1

Closed

bindValue() is not accepting non-english chars

description

I cannot put non english chars as params in bindValue(), like à.

Please see this code: http://pastebin.com/QBahEFBG

It triggers this exception:

Database::DataTable: IMSSP - SQLSTATE[IMSSP]: An error occurred translating string for input param 1 to UCS-2: No mapping for the Unicode character exists in the target multi-byte code page.


Please note that enabling the commented-out line (setAttribute) doesn't help.
Any idea?
Closed Mar 20, 2012 at 6:26 PM by
Glad to see you worked it out. :)

comments

robertjohnson wrote Mar 16, 2012 at 1:21 PM

http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/threads

Is your source file UTF-8 encoded, or have you tried something like this?:
$stmt->bindValue(":val", utf8_encode('à'), PDO::PARAM_STR);

fmntf wrote Mar 20, 2012 at 7:58 AM

Excuse me, I created the file under Linux in UTF-8. Then I copied it in Windows and updated db params with notepad++, which changed the encoding.

The issue does not exist and can be closed.