I'm using SQLAPI++ to build a backend application which needs to access a database (SQL Server 2014). When I try to read a string (nvarchar(50)) from a result set that contains non-ascii characters (specifically persian characters), the cmd.Field("MyField").asString().GetxxxChars()
methods all return question marks (?) instead of those characters.
What should I do?
I have also tried asBytes()
and asLongChar()
and got the same results.
So I found the problem!
I was linking with sqlapis.lib. I checked this link and found out that I should use sqlapius.lib instead for unicode support. I also needed to define SA_UNICODE.
It is now working fine.