Reputation: 13
We are using a SQL Server database and C++, and we have several inquiries about the issues we are currently facing.
Here's some information about our situation:
Chinese_Taiwan_Stroke_CI_AS
is being used as collation in the databaseVARCHAR(200)
is used as a parameterA
procedure, and it passes Unicode(UTF-8) to the VARCHAR
parameterDue to this, data corruption occurs when a value is stored in the database. So far, we have understood up to this part.
These are the results we obtained after the tests we did
韓國人學台語
.SELECT '韓國人學台語' COLLATE Chinese_Taiwan_Stroke_CI_AS
, the string comes out normally without being broken.A
procedure and sends 韓國人學台語
to the parameter, the data is normally displayed.This is the inquiry we want to ask: when you store Unicode value in VARCHAR
, it appears that the results are shown differently when you store the data through the server and when you save it through running T-SQL query directly.
We need your explanation about this part.
--------------------------------------------------Edit!
I am using a translator. i look forward to your understanding.,_,)
I am careful to raise problem the stored procedure and the schema of the table uploaded.
I have read many replies with thanks,
if i using unicode, I understood if not using approciate Collation-Rule, we need using NVARCHAR.
As ZLK said, we believe there is a problem with the way the server delivers it. We'll look further and we'll leave a message as soon as we know the cause.
Thank you for your reply.
Upvotes: 1
Views: 482
Reputation: 416149
If you want to use UTF-8, use the NVARCHAR
type and make sure to use an N
prefix with any string literals, like this: N'韓國人學台語'
Native UTF-8 support in the VARCHAR
type is coming in the Sql Server 2019 release. Until then, you'll just have to use the larger type.
Upvotes: 1