How to determine encoding of a string.

F

Frank Rizzo

I read a string out of a database, which contains serialized objects.
How can I determine the encoding of the string?

Thanks
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

AFAIK there is no way to determine the encoding of a string, you will have
to save the encoding when you save the string in the first place.
 
C

Chris Mullins [MVP]

Frank Rizzo said:
I read a string out of a database, which contains serialized objects. How
can I determine the encoding of the string?

If the datatype that you're using in .Net is a string, then the encoding is
UTF-16. By definition, all .Net strings are UTF-16 encoded.

The only way you can have a different encoding is if you're reading the data
out of the database as a byte array. If you're looking at a byte array, I
don't know of any definitive way to tell the encoding.
 
K

Kevin Yu [MSFT]

Hi Frank,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top