String of UTF8 data to byte(), HOW??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Søren M. Olesen

    String of UTF8 data to byte(), HOW??

    Hi

    How do I create an array of bytes from a string containig UTF8 ??

    Dim xmlfragment as string="<Node Name='Søren' />" 'My name ... Søren
    Dim ase As ASCIIEncoding = New ASCIIEncoding
    Dim xmlstream As MemoryStream = New MemoryStream(as e.GetBytes(xmlf ragment),
    0, xmlfragment.Len gth)
    Dim reader As XmlTextReader = New XmlTextReader(x mlstream)
    While Reader.reas
    ....
    End While

    However it seem like the ASCIIEncoding class converts everything to
    7-bit....how do I maintain it in 8-bit??

    TIA

    Søren


  • Herfried K. Wagner [MVP]

    #2
    Re: String of UTF8 data to byte(), HOW??

    "Søren M. Olesen" <smolesen@hotma il.com> schrieb:[color=blue]
    >
    > How do I create an array of bytes from a string containig UTF8 ??[/color]

    \\\
    Dim abyt() As Byte = System.Text.Enc oding.UTF8.GetB ytes(...)
    ///

    --
    Herfried K. Wagner [MVP]
    <URL:http://dotnet.mvps.org/>

    Comment

    Working...