empira / PDFsharp

PDFsharp and MigraDoc Foundation for .NET 6 and .NET Framework
https://docs.pdfsharp.net/
Other
474 stars 110 forks source link

When exporting PDF, all Chinese characters become squares #164

Open Neilsons opened 1 week ago

Neilsons commented 1 week ago

Expected Behavior The report downloaded using asp.net core api is displayed normally in Chinese。

Actual Behavior The report downloaded using asp.net coreapi using .net6 displays normally in Chinese. It can be downloaded normally when deployed on window, and the generated PDF can also display normally in Chinese. It can also generate normal PDF when run on a linux (console program) physical machine. However, when the generated PDF is deployed in a container, the Chinese characters are not displayed normally, and are all squares. The numbers can be displayed normally. I'm not sure if it is a font problem or an encoding problem in the deployment environment.

The font embedding method used

The font parser is GeneratePDf.zip

The font is already embedded in the assembly。

Neilsons commented 1 week ago

Solved. The encoding format of the files generated by pdf is Simplified Chinese (GB2312) - code page 936, which should be adjusted to Uniconde (UTF-8 with signature) - code page 65001

ThomasHoevel commented 6 days ago

The encoding format of the files generated by pdf is Simplified Chinese (GB2312) - code page 936, which should be adjusted to Uniconde (UTF-8 with signature) - code page 65001

I'm afraid I don't understand. Was it a change in your code or did you change PDFsharp?