![]() This can be converted to UTF8 correctly using iconv. Firefox text encoding not work driver#In driver version 1.1, the text is sent back as ISO-8859-1 from my SQL Server, which is probably the default character set.Sample code at the bottom will recreate the error. Obviously this code is just the most relevant excerpts from a Database Abstraction Layer which I have written to wrap PDO, it manages Access and MySQL DB's too. file_put_contents('C:\tmp\convUserMsg.txt', "DEBUG $strMsg\n") If ($this->strCharsetDBC = $this->strCharsetMsg) from $this->strCharsetDBC to $this->strToCharsetMsg $this->objDbh->setAttribute( PDO::SQLSRV_ATTR_ENCODING,Īnd then the logging routine, called wherever an error is detected in the further abstraction functions: $this->objDbh = new PDO($strDsn, $mixParUser, $mixParPass, $arrAttributes) If (!$this->blnIsOdbc) $arrAttributes = TRUE Make all connections except ODBC persistent $arrAttributes = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, Override default error mode - ensure exceptions are thrown Here's an (edited) excerpt of the most relevant code: In Ungültig) is not a valid char in either charset, iconv() truncates the message at that point and I don't see the actual error in the log. So I use PHPs iconv() to convert the error message for logging, and since x81 (for the "ü" ![]() My real problem is that my Website (and preferred charset for PDO) is UTF-8, but my logs are for historical reasons in ISO-8859-1. I'm running Windows Vista Business SP2 with automatic Windows Update, so everything should be right up to date (it's also a most recentĪnd complete version of MSSQL). Sorry, I thought the OS would be sufficiently described by the Info from Management Studio.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |