PC Review


Reply
Thread Tools Rate Thread

How to determine encoding of a string.

 
 
Frank Rizzo
Guest
Posts: n/a
 
      5th Jan 2007
I read a string out of a database, which contains serialized objects.
How can I determine the encoding of the string?

Thanks
 
Reply With Quote
 
 
 
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      5th Jan 2007
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.


--
Ignacio Machin
machin AT laceupsolutions com



"Frank Rizzo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I read a string out of a database, which contains serialized objects. How
>can I determine the encoding of the string?
>
> Thanks



 
Reply With Quote
 
Chris Mullins [MVP]
Guest
Posts: n/a
 
      5th Jan 2007
"Frank Rizzo" <(E-Mail Removed)> wrote
>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.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, MVP C#
http://www.coversant.net/blogs/cmullins


 
Reply With Quote
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      10th Jan 2007
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.)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how does ado.net SqlDataReader.GetString() know which encoding to read the data into a string as? Does sql sever set this at the column data type level, server wide encoding setting, os encoding? Daniel Microsoft C# .NET 1 25th Mar 2007 05:47 PM
how does ado.net SqlDataReader.GetString() know which encoding to read the data into a string as? Does sql sever set this at the column data type level, server wide encoding setting, os encoding? Daniel Microsoft Dot NET Framework 1 8th Mar 2007 11:06 AM
how does ado.net SqlDataReader.GetString() know which encoding to read the data into a string as? Does sql sever set this at the column data type level, server wide encoding setting, os encoding? Daniel Microsoft ADO .NET 0 7th Mar 2007 11:15 PM
how does ado.net SqlDataReader.GetString() know which encoding to read the data into a string as? Does sql sever set this at the column data type level, server wide encoding setting, os encoding? Daniel Microsoft Dot NET 0 7th Mar 2007 11:12 PM
Determine encoding Ryu Microsoft C# .NET 2 29th Nov 2004 09:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:47 PM.