MigraDoc RTF Document cannot translate special characters

161 Views Asked by At

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.

2

There are 2 best solutions below

1
I liked the old Stack Overflow On BEST ANSWER

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.

0
Dom On

With the newest version, it is possible to use special language characters as well. (Version PDFsharp-MigraDoc 6.0.0-preview-2 )