Click here to Skip to main content
15,892,059 members
Articles / Programming Languages / Visual Basic

Convert a string to UTF-16

Rate me:
Please Sign up or sign in to vote.
3.67/5 (3 votes)
28 Mar 2010CPOL 27.5K   3  
This Function allows you to convert a normal string to UTF-16 encoding in VB.NET. You can find tools like Unicode Code Converter that operate like ConvertToUTF16 function.' if you pass this parameter to function : "I'm from Azerbaijan."' the return value is :...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
29 Mar 2010Daniel Leykauf
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...

License

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


Written By
-
Turkey Turkey
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions