Breaks encoding in richtextbox

I use richtextbox in my winform application. When I paste "ជំរាបសួរ Khmer" text all good:

But when I paste "'مرحب Arabic" text some problems appear: in the first insert having problems with the encoding:

I have not found any Enсoding properties in richtextbox. How do I solve the problem of encoding?


Use RichTextBox v5. The default in Visual Studio is v4. It fixes this problem among others.

public class RichText50W : RichTextBox
{
    [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
    static extern IntPtr LoadLibrary(string lpFileName);
    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams prams = base.CreateParams;
            if (LoadLibrary("msftedit.dll") != IntPtr.Zero)
            {
                prams.ClassName = "RICHEDIT50W";
            }
            return prams;
        }
    }
}
链接地址: http://www.djcxy.com/p/16928.html

上一篇: UIActivityViewController和UIDocumentInteractionController

下一篇: 在richtextbox中打破编码