Open GoogleCodeExporter opened 9 years ago
You should check your file is saved in UTF-8 (some editors doesn't handle
encoding correctly)
año seems not to be in latin-1
Can you attach the file?
I should recommend you to use utf-8 directly, changing:
# -*- coding: utf-8 -*-
and then
pdf.cell(ln=0, h=10.0, align='C', w=75.0, txt=u'año', border=1)
(note the u in front of the string)
Latin-1 (ISO 8859-1) should not be a problem, but you can check specific
unicode support here:
http://code.google.com/p/pyfpdf/wiki/Unicode
Original comment by reingart@gmail.com
on 30 Sep 2012 at 4:12
Thanks for the response. Here is the error I am seeing now:
~/pyfpdf/fpdf.py:393: UnicodeWarning: Unicode equal comparison failed to
convert both arguments to Unicode - interpreting them as being unequal
w += cw.get(s[i],0)
Traceback (most recent call last):
File "issue.py", line 20, in <module>
pdf.output('SpanishWord.pdf', 'F')
File "~/pyfpdf/fpdf.py", line 871, in output
self.close()
File "~/pyfpdf/fpdf.py", line 286, in close
self._enddoc()
File "~/pyfpdf/fpdf.py", line 1188, in _enddoc
self._putpages()
File "~/pyfpdf/fpdf.py", line 964, in _putpages
p = zlib.compress(self.pages[n])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position
85: ordinal not in range(128)
I am using vim which handles file encoding well, however I may not be handling
the encoding correctly.
Please find the file attached.
Original comment by jon.hei...@gmail.com
on 1 Oct 2012 at 4:59
Attachments:
Sorry, I cannot reproduce the bug.
I tested your code and it does work (attached is the sample pdf)
Are you using the latest version 1.7.1?
Original comment by reingart@gmail.com
on 4 Oct 2012 at 4:45
Attachments:
I am using the 1.54b version that is in the pyfpdf zip. Running on a mac, so
didn't pull down the win msi versions. Maybe the source version 1.7.1 will fix
this.
Is the 1.54b zip not been updated or is the pyfpdf package different than the
fpdf package?
Original comment by jhei...@realtaentertainment.com
on 4 Oct 2012 at 9:42
Please usa at least 1.7 version
http://pyfpdf.googlecode.com/files/fpdf-1.7.zip
pyfpdf is the old package name, now you just have to import fpdf
(previous name should work, but depends on how it is intalled)
See unicode.py tutorial for a full example:
http://code.google.com/p/pyfpdf/source/browse/tutorial/unicode.py
(if you use non-latin1 chars, you will need to grab the ttf font pack)
Original comment by reingart@gmail.com
on 4 Oct 2012 at 11:32
Original issue reported on code.google.com by
jon.hei...@gmail.com
on 29 Sep 2012 at 7:26