Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

October 18, 2007

C# to convert from utf-8 bytes to string and back.

            System.Text.Encoding utf_8 = System.Text.Encoding.UTF8;
	
            // This is our Unicode string:
            string s_unicode = "abcéabc";
	
            // Convert a string to utf-8 bytes.
            byte[] utf8Bytes = System.Text.Encoding.UTF8.GetBytes(s_unicode);
	
            // Convert utf-8 bytes to a string.
            string s_unicode2 = System.Text.Encoding.UTF8.GetString(utf8Bytes);
	
            MessageBox.Show(s_unicode2);


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.