Skip to Content.
Sympa Menu

freetds - Re: [freetds] Cannot send UTF-8 chars to MSSQL 2008

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Niklas Lampén <Niklas.Lampen AT eventusmedia.fi>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Cannot send UTF-8 chars to MSSQL 2008
  • Date: Fri, 4 Jun 2010 14:26:58 +0300

> >>> 1> UPDATE Mod_Texts SET ContentData='foo Найти' WHERE
> ContentId=6824;
> >> Is that field even capable of storing Cyrillic letters?
> > Yes, it is. The field is NVARCHAR and if I use Microsoft SQL Server
> Management Studio, I can insert that string in it and fetch it correctly
> with FreeTDS.
>
> Try inserting it like this instead:
>
> ContentData=N'foo Найти'
>
> Note the extra N before the quotes.

That works, thanks! Now that you pointed that out, it's obvious it should be
that way. It's easy to be smart afterwards...

Calling stored procedure with tsql

1> EXECUTE Mod_Text_Put_Content @ContentId=6824, @Content=N'Найти',
@SiteId='niklas'
2> go

is a success, too. Now I just have to figure out how to submit that data from
PHP with this Unicode marking N. I can choose field types for mssql_bind()
from SQLTEXT, SQLVARCHAR, SQLCHAR, SQLINT1, SQLINT2, SQLINT4, SQLBIT,
SQLFLT4, SQLFLT8, and SQLFLTN. As one can see, there is no SQLNVARCHAR or
equivalent.


Niklas




Archive powered by MHonArc 2.6.24.

Top of Page