Skip to content

[Bug]: Chinese fonts are displaying as garbled characters #20489

@wwh-lyl

Description

@wwh-lyl

Attach (recommended) or Link to PDF file

Web browser and its version

Google Chrome 142.0.7444.177

Operating system and its version

Windows10

PDF.js version

5.4.394

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

1.Open the file test1.pdf using the PDF viewer

What is the expected behavior?

On the first page of the document, the area in the lower right corner displays the Chinese text "北斗星".

What went wrong?

On the first page of the document, the area in the lower right corner displays garbled characters "±±¶·ÐÇ" instead of the correct Chinese text.

Link to a viewer

No response

Additional context

1.When I opened test1.pdf in WPS, I checked its document properties and found that in the font information, one of the non-embedded fonts is "宋体" , but its encoding is displayed as WinAnsiEncoding.
2.The garbled characters "±±¶·ÐÇ" are a typical result of the Chinese text "北斗星" being decoded with an incorrect character encoding (e.g., misinterpreted as a single-byte encoding like ISO-8859-1 instead of GB2312/GBK or UTF-8).
3. When I opened the same test1.pdf file in WPS and in Google Chrome (using the browser's built-in PDF viewer), the Chinese characters for "北斗星" displayed correctly. It seems that these applications may have implemented some form of compatibility handling for such encoding issues.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions