Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Convert a string to UTF-16

5.00/5 (3 votes)
29 Mar 2010CPOL 1  
Same function and little bit easier:Imports System.Runtime.Remoting.Metadata.W3cXsd2001Class Converter Public Shared Function ConvertToUTF16(ByVal str As String) As String Return New SoapHexBinary(System.Text.Encoding.BigEndianUnicode.GetBytes(str)).ToString End...
Same function and little bit easier:

VB
Imports System.Runtime.Remoting.Metadata.W3cXsd2001

Class Converter
    Public Shared Function ConvertToUTF16(ByVal str As String) As String
        Return New SoapHexBinary(System.Text.Encoding.BigEndianUnicode.GetBytes(str)).ToString
    End Function
End Class

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)