Click here to Skip to main content
15,883,933 members
Articles / Programming Languages / Visual Basic
Alternative
Tip/Trick

Convert a string to UTF-16

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
29 Mar 2010CPOL 12.5K   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)


Written By
Business Analyst
Austria Austria
I am working as Business Analyst and Development Specialist for an international bank since 1993.

Comments and Discussions

 
-- There are no messages in this forum --