2 Jun 2010 10:15
Cannot send UTF-8 chars to MSSQL 2008
Niklas Lampén <Niklas.Lampen <at> eventusmedia.fi>
2010-06-02 08:15:09 GMT
2010-06-02 08:15:09 GMT
Hi,
I'm trying to send a string "Найти" (which is Russian, I don't know what it means) from PHP to MSSQL
server using FreeTDS, but I end up with empty column in MSSQL. Iäm using a stored procedure called
Mod_Text_Put_Content with three parameters <at> Content (containing the string), <at> ContentId and <at> SiteId.
The string is originally in UTF-8. ISO-8859-1 compatible strings like "abc" are stored to database as expected.
I'm trying this with freetds-0.83.dev.20100522. Freetds-0.82 gives an error and does not send empty
string to database.
I tested that my iconv works as expected by creating a file with string "Найти" in it and did:
# iconv -futf-8 -tucs2 --verbose -oucs2.txt utf8.txt
# iconv -fucs2 -tutf8 --verbose -outf8.txt_2 ucs2.txt
# hexdump utf8.txt
0000000 9dd0 b0d0 b9d0 82d1 b8d0 000a
000000b
# hexdump utf8.txt_2
0000000 9dd0 b0d0 b9d0 82d1 b8d0 000a
000000b
# hexdump ucs2.txt
0000000 041d 0430 0439 0442 0438 000a
000000c
My freetds.conf looks like this:
---
[global]
text size = 64512
port = 1433
(Continue reading)
RSS Feed