Description
Description
Loading some RTF in a RichTextBox
, saving it and loading it again causes an exception to be thrown.
This happens because the RTF contains a hyperlink which contains an umlaut ("ö" in this example).
That umlaut is correctly escaped in the source RTF with "'f6".
Loading the source RTF works fine.
Saving the RTF with RichTextBox
causes the correctly escaped text to become 'f6
.
Loading this again causes an exception while trying to construct the NavigationUri, as an unescaped "'" is not valid in an URI.
After some investigation the issue seems to be that:
XamlToRtfWriter.WriteInlineChild calls BamlResourceContentUtil.UnescapeString which then simply removes the "\" before the "'", thus producing an invalid URI.
One way to solve this would be to add
else if (documentNode.NavigateUri[i] == "'")
{
_rtfBuilder.Append("\\'");
}
Reproduction Steps
See attached repro project.
UmlautIssue.zip
Expected behavior
No exception should occur and RTF should be rendered.
Actual behavior
Exception is thrown during load (after save from RichTextBox
).
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
Tested with .NET 4.8 and .NET 6.0.
Other information
No response
Activity