0

Due to this I have a table full of varchar values (e.g., 戦艦å¸å›½) that I need to convert to proper unicode nvarchar values (e.g.,戦艦帝国). How can I do that within T-SQL?

Community
  • 1
  • 1
feetwet
  • 3,248
  • 7
  • 46
  • 84
  • I doubt that's possible unless someone painstakingly wrote some app to do it. There's just no mapping (I'm assuming)...how could there be? Who keeps it up to date? – rory.ap Apr 03 '17 at 20:27
  • @rory.ap - Perhaps I need to include this detail: the values were originally from inserted to the DB with ASP code running with an IIS CodePage = 936. Somehow that ASP is magically able to get them back out of the database and into their original unicode majesty as long as the CodePage and CharSet aren't touched.... – feetwet Apr 03 '17 at 20:33
  • If it's a UTF-8 encoding, it may be possible... but you'd need to do it in C# code and not in SQL. You'd add the nvarchar() column, then run a utility that reads the UTF-8 encoded string, and then writes out a UTF-16 encoded unicode string to the new column. After you're done, you could drop (and rename?) the new column. The C# text stream reader & writer classes have the option to specify encodings for just such translations. – pmbAustin Apr 03 '17 at 21:13

0 Answers0