gruber
gruber

Reputation: 29779

Any chance to recover unicode data from varchar column

Unicode data (cyrillic) was written into database column of type varchar

Is there any chance to recover that data in correct format?

It doesn't have to be fully recovered, anything will be great

Thanks for any help

Upvotes: 2

Views: 207

Answers (1)

Martin Smith
Martin Smith

Reputation: 453837

No.

This is a lossy conversion as double byte characters cannot possibly all be represented in a single byte scheme. All characters not coercible into the code page of your default collation will have been converted to ?.

There is no way of reverse engineering back what that ? originally was supposed to represent or any other less severe conversions that may have happened along the way (e.g characters converted to somewhat similar homopglyph characters).

Example

DECLARE @T TABLE 
(
V VARCHAR(10)
)
INSERT INTO @T 
VALUES (N'中华人民共和国');

SELECT V,
       CAST(V AS VARBINARY(10))
FROM @T

Output

V          
---------- ----------------------
???????    0x3F3F3F3F3F3F3F

You can clearly see that all the different characters in the source get stored as the same thing.

Upvotes: 5

Related Questions