473,465 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to determine encoding of a string.

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

Thanks
Jan 5 '07 #1
4 14317
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" <no**@none.comwrote in message
news:OH**************@TK2MSFTNGP02.phx.gbl...
>I read a string out of a database, which contains serialized objects. How
can I determine the encoding of the string?

Thanks

Jan 5 '07 #2
"Frank Rizzo" <no**@none.comwrote
>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
Jan 5 '07 #3
I agree. By design, all the strings in .NET is Unicode. The strings can
only be encoded to byte array with other formats. If you need to maintain
the encoding information, you can try to add some bytes at the beginning of
the array.

If anything is unclear, please feel free to let me know.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

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

Jan 8 '07 #4
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.)

Jan 10 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ed S | last post by:
Hi All, I am sharing some business logic C# code between a .NET Web App and a ..NET forms app (Web App came first, and now I'm doing the Forms App). In some of my code I am using...
6
by: lisa.lin | last post by:
Hi,all Is there any library function to tell a string to be a number? I did't find it in <string.h>, does anyone kow? Thanks in advance! Lisa Lin
2
by: Ryu | last post by:
Is there a way to determine if a text is ASCII or Unicode in C#. I have looked at Encoding classes but I have found that They dont allow me to pass a text to the encoding obj. In addition is there...
3
by: writebrent | last post by:
For database purposes, I need an easier /faster way of comparing two strings for equivalency. I have the idea of somehow converting the string to a unique number, storing that number in the...
2
by: Alex | last post by:
Is there an easy way to encode in javascript a string to another string that would have HTML safe characters like & to $amp; and such?
9
by: Mantorok | last post by:
Hi all I have a plain text string, sometimes the string will contain special characters, how can I encode this string in xml format? Thanks Kev
2
by: christian.eickhoff | last post by:
Hello Everyone, I am facing a problem which should be relatively easy to solve for XML or XERCES experts. I am parsing my XML instance using xerces-c SAXParser. For internal purposes, it is...
0
by: Jeff Groves | last post by:
I'm using FreezePython on a Python program that uses wxPython and subprocess. The result almost works, but it always hits this bug: File "velauncher.py", line 847, in Launch File...
1
by: Oleg Subachev | last post by:
I need to read XML file, transform it and then save in the same encoding. XmlDocument class naturally has no encoding-related members. How can I determine encoding of XML file ? Oleg Subachev
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.