向richtextbox中插入中文出现乱码的问题
从codeproject下载了一段代码:
public void InsertLink(string text, string hyperlink, int position)
{
if (position < 0 || position > this.Text.Length)
throw new ArgumentOutOfRangeException( "position ");
this.SelectionStart = position;
this.SelectedRtf = @ "{\rtf1\ansi "+text+@ "\v # "+hyperlink+@ "\v0} ";
this.Select(position, text.Length + hyperlink.Length + 1);
this.SetSelectionLink(true);
this.Select(position + text.Length + hyperlink.Length + 1, 0);
}
结果在调用该方法并插入汉字时出现乱码,但是英文没有问题,请问是怎么回事?
------解决方案--------------------up