smalot / smalot/pdfparser

Chinese text problems

Open
#664 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug de-/encoding issue parsing fail
Dominant language
PHP
Stars
2.7k
Forks
579
Avg merge
2m
Merged PRs (30d)
1

Description

  • PHP Version: 8.2
  • PDFParser Version: 2.8 RC 2
Description:
PDF input

在历史的风陵渡口 (高华) (Z-Library).pdf

Expected output & actual output

I get an avalanche of weird characters Ex:
\nµ¡úÕ╝ÅÕ«úÕ©âÕ╝ÇÕ▒òÞé⵩àÕ£░õ©╗Õ»îÕå£þÜäµûùõ║ëÒÇéÚÇÜÕæèµîçÕç║´╝ÜÞÁúÞÑ┐ÕìùÕàÜÕåൣëõ©Çõ©Ñ\nÚçìþÜäÕì▒µ£║´╝îÕì│Õ£░õ©╗Õ»îÕå£ÕààÕí×ÕàÜþÜäÕÉäþ║ºÕ£░µû╣µîçÕ»╝µ£║Õà│´╝îÕàÜþÜäµö┐þ¡ûÕ«îÕà¿\nµÿ»µ£║õ╝Üõ©╗õ╣ëþÜäµö┐þ¡û´╝îÞïÑõ©ìÕ¢╗Õ║òÞé⵩à´╝îõ©ìõ¢åõ©ìÞ⢵ëºÞíîÕàÜþÜäõ╝ƒÕñºþÜäµö┐µ▓╗\nõ╗╗Õèí´╝îÞÇîõ©öÚØ®Õ梵á╣µ£¼ÞªüÚü¡Õñ▒Þ┤ÑÒÇéÞüöÕ©¡õ╝ÜÞ««ÕÅÀÕżÕàÜÕåàÚØ®Õæ¢ÕÉîÕ┐ùÞ

Code

$pdf = $parser->parseFile(storage_path('app/'.$path));
dd($pdf->getText());

I`m on Ubuntu 22,I have the chinese language installed. Thanks for your work!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the linked Chinese PDF on Ubuntu 22 using PHP 8.2, starting from parseFile() and inspecting the output of getText(). Compare the extracted Chinese text with the PDF input; done means identifying and correcting the character corruption without breaking extraction for the reported document.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.