Mega Code Archive

 
Categories / C# / Internationalization
 

Ptr To String Utf8

using System; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; namespace Scintilla {     public class Utilities     {     public unsafe static string PtrToStringUtf8(IntPtr ptr, int length)         {             if (ptr == IntPtr.Zero)                 return null;             byte[] buff = new byte[length];             Marshal.Copy(ptr, buff, 0, length);             return System.Text.UTF8Encoding.UTF8.GetString(buff);         }     } }