|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
memory stream, xmltextwriter issuei have the following class: <Serializable()> _ Public Class MVR_Inputs Public FirstName As String Public MiddleName As String Public LastName As String Public Suffix As String Public Dob As String Public Ssn As String Public Gender As String Public DriversLicenseNumber As String Public DriversLicenseState As String Public YouthCheck As String Public CustomerBatchID As String Public CustomerOrderID As String Public TestMode As Boolean = False Public TimePeriod As Integer Public RequestType As String End Class which i attempt to serialize by using this code: Dim objMemStrm As MemoryStream Dim objXmlWriter As XmlTextWriter Dim objXmlSerializer As XmlSerializer Dim byteArray() As Byte objMemStrm = New MemoryStream objXmlWriter = New XmlTextWriter(objMemStrm, Encoding.UTF8) objXmlSerializer = New XmlSerializer(oSubject.GetType()) objXmlSerializer.Serialize(objXmlWriter, oSubject) byteArray = objMemStrm.GetBuffer sSerializedReq = System.Text.Encoding.UTF8.GetString(byteArray) the serialization works fine, except that the first character of of sSerializedReq is always ASCII character 239 - an i with 2 small dots on top any ideas ? thanks in advance The characters are the Byte Order Mark (BOM)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/unicode_42jv.asp which are emitted when using the default UTF8 encoding To prevent them being emitted use an instance of the UTF8 Encoding that does not emit them i.e. objXmlWriter = New XmlTextWriter(objMemStrm, New System.Text.UTF8Encoding(False)) hth, Alan.
Re: Store multi-choice groupbox selection in a field
Form size ??? Do properties return byref or byval? select text in textbox DataGridView DataBinding PERFORMANCE QUESTION .vbprog not installed! VB 2005 - URGENT Check Mapped Drive is Connected Viewing Word Docs in Tabs Serilization of custom object |
|||||||||||||||||||||||