Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPDF 'latin-1' encoding error #1

Open
falkecarlsen opened this issue Mar 1, 2021 · 0 comments
Open

FPDF 'latin-1' encoding error #1

falkecarlsen opened this issue Mar 1, 2021 · 0 comments

Comments

@falkecarlsen
Copy link
Member

It seems FPDF assumes Windows specific, non-standard 'latin-1' encoding according to: https://stackoverflow.com/questions/3942888/unicodeencodeerror-latin-1-codec-cant-encode-character. This makes FPDF error out with the following message: UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f438' in position 2953: ordinal not in range(256).

Hotfix that worked for me: replace 'latin1' with 'utf-8' for encoding in fpdf.py at line 1170 for fpdf v1.7.2:
p = self.pages[n].encode("utf-8") if PY3K else self.pages[n]

Note this is a copy of issue 16 in original repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant