Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Breaks encoding in richtextbox

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

enter image description here

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

enter image description here

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

like image 431
Nikolay Avatar asked Oct 25 '13 13:10

Nikolay


1 Answers

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;
        }
    }
}
like image 124
Jerry Avatar answered Sep 21 '22 23:09

Jerry