Search code examples
c#.netrtfmigradoc

MigraDoc RTF Document cannot translate special characters


I created an application, where we want to create .rtf & .pdf Documents. The documents also contain characters like ä,ü,ö,ß and we have the big issue, that those special characters are not shown correctly in the RTF Document.

For creating the rtf document, we are using "Migradoc" and the "RtfDocumentRenderer".

The PDF will be created correctly... And for the rtf document, we already tried a few things:

  • Setting the UTF encoding before calling the renderer

  • changing the culture info

  • creating the document as byte array, converting it to an array, encoded the byte array, but without success

  • with Unicode instead of the character.


Solution

  • The current version 1.51 of PDFsharp/MigraDoc targets .NET 2.0/.NET 3.5. Special characters work with .NET Framework versions up to 4.x.

    The next version of PDFsharp (preview versions of 6.0.0 have already been published) targets .NET 6 and properly deals with the change of the default encoding.