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

hebrew #180

Open
yishairasowsky opened this issue Mar 24, 2021 · 3 comments
Open

hebrew #180

yishairasowsky opened this issue Mar 24, 2021 · 3 comments

Comments

@yishairasowsky
Copy link

when i tried to put in hebrew, then it failed. can i share a screen shot?
this works:

from fpdf import FPDF

pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size = 15)
pdf.cell(200, 10, 
         txt = 'abc', 
         ln = 1, align = 'C')
pdf.output("GFG.pdf")   

but when i change to txt = 'אבג'
then i get an error:

---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)
<ipython-input-21-cb3542cc6029> in <module>()
      7          txt = 'אבג',
      8          ln = 1, align = 'C')
----> 9 pdf.output("GFG.pdf")

3 frames
/usr/local/lib/python3.7/dist-packages/fpdf/fpdf.py in _putpages(self)
   1168             if self.compress:
   1169                 # manage binary data as latin1 until PEP461 or similar is implemented
-> 1170                 p = self.pages[n].encode("latin1") if PY3K else self.pages[n]
   1171                 p = zlib.compress(p)
   1172             else:

UnicodeEncodeError: 'latin-1' codec can't encode characters in position 51-53: ordinal not in range(256)
@yishairasowsky
Copy link
Author

@Lucas-C
Copy link

Lucas-C commented Mar 27, 2021

This project is not maintained anymore, cf. #171

Also, this question has already been answer on StackOverflow: https://stackoverflow.com/questions/57806280/unicodeencodeerror-latin-1-codec-cant-encode-when-trying-to-write-hebrew-to

@yishairasowsky
Copy link
Author

yishairasowsky commented Mar 28, 2021 via email

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

2 participants