user513270
user513270

Reputation: 1

How to output unicode?

Hey guys, I need to export data from database which contains Unicode(like Japanese characters). While when i trying to export to csv files, it just becomes the garbage....

First, I need to read data from database and save it to an datatable Second, I will make a query based on the datatable (Using Linq) Last, Export the queried results to csv file

Is there any way to solve this problem?

Thanks a lot.

Upvotes: 0

Views: 292

Answers (2)

GvS
GvS

Reputation: 52518

Internally .Net (C#) always uses unicode. The problems occur when you export the data. Then you need to specify an encoding.

If you use File.CreateText you immediatly create a UTF-8 encoded file.

Does the application you use for import, recognize the UTF-8 encoding, or does it need a specific encoding?

Upvotes: 1

Przemysław Michalski
Przemysław Michalski

Reputation: 9847

Try to set connection data collation to unicode_ci or more specidfied.

Upvotes: 0

Related Questions