I've hit a brick wall with updating an SQL database via the DatabaseUpdate routine where unicode characters are involved.
I'm able to read unicode text via DatabaseQuery thanks to information in other threads on the forum. I do have the Unicode compiler option turned on. I've debugged the strings retrieved via DatabaseQuery and they do contain the unicode text. Operating system is Windows Server 2008; database is on an SQL Server 2008R2 server.
However, when I build an SQL statement that includes unicode text and execute it via DatabaseUpdate, the "unicode text" that makes it into the database just contains a bunch of ?'s in place of non-ASCII characters. I've checked the database fields and they are the unicode-compatible nvarchar format.
Any tricks to using DatabaseUpdate with unicode text?
Thank you!
-Tim.
ODBC DatabaseUpdate and Unicode
Re: ODBC DatabaseUpdate and Unicode
Hi,
first: are you sure that you use an ODBC driver which can handle unicode?
Then you can try to put an N before your text like:
Bernd
first: are you sure that you use an ODBC driver which can handle unicode?
Then you can try to put an N before your text like:
Code: Select all
N'unicode text'Re: ODBC DatabaseUpdate and Unicode
That worked! Thanks for the help!
-Tim.
-Tim.
Re: ODBC DatabaseUpdate and Unicode
A public explanation of the magic 'N' could/would be helpful for educational purposes. References and links are welcome.
Re: ODBC DatabaseUpdate and Unicode
Thx infratec! I thought PB uses UTF8 strings with databases and Unicode.infratec wrote:http://databases.aspfaq.com/general/why ... refix.html
-
Num3
- PureBasic Expert

- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Re: ODBC DatabaseUpdate and Unicode
Interesting stuff!
BTW, link is dead, i read this article instead:
http://stackoverflow.com/questions/1002 ... statements
On a side note, purebasic works great with UTF8 + Mysql server out of the box, so this problem is specific to MSSQL.
BTW, link is dead, i read this article instead:
http://stackoverflow.com/questions/1002 ... statements
On a side note, purebasic works great with UTF8 + Mysql server out of the box, so this problem is specific to MSSQL.
- the.weavster
- Addict

- Posts: 1583
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
Re: ODBC DatabaseUpdate and Unicode
With Firebird >= 2.5 you specify what encoding your application will be sending as part of the DSN setup. Firebird then automatically transliterates between that and the charset of the database you're connecting to.

