How to determine encoding of a string.

  • Thread starter Thread starter Frank Rizzo
  • Start date Start date
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
 
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.
 
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.
 
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.)
 
Back
Top