Closed giorgiozoppi closed 3 years ago
Can you send me an example of the document? As a side note, with non-ASCII (that is non-English) characters, RTF tends to work better when read from a stream than from a string. However, I can help more if I have an example of the document. Thanks!
Hello, i have a problem in ASP.net with Spanish chars in rtf. I am fetching the params from the db. Example the rtf A continuaci#f3n should be translated in html with ó
private string ToHtml(string text) { if (string.IsNullOrEmpty(text)) { return string.Empty; } if (text.StartsWith(@"{\rtf1")) { var correction = Rtf.ToHtml(text);; // i have to change this. correction = correction.Replace("f3", "ó"); correction = correction.Replace("e1", "é"); return correction; } var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(text); if (htmlDocument.ParseErrors.Any()) { return text; } // if it is an invalid html we treat as html. return "
" + text + "
"; }