Breaks encoding in richtextbox

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

enter image description here

But when I insert the text "مرحب Arabic", there are some problems: in the first insert there are problems with the encoding:

enter image description here

I did not find any Encoding properties in richtextbox. How to solve the encoding problem?

+7
c # encoding richtextbox
source share
1 answer

Use RichTextBox v5. The default value in Visual Studio is v4. He 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; } } } 
+3
source share

All Articles