Hi José, thank you. "latin-1" code is the answer!

2012/1/2 José Luis Redrejo Rodríguez <[email protected]>

> Hi Martin, I'm using this in the controller, without any problem:
>
>
> # coding: utf8
> ...
>    from gluon.contrib.pyfpdf.pdflabels import PDFLabel
>
>    import sys
>    reload(sys)
>    sys.setdefaultencoding( "latin-1" )
>    ...
> def label_parejas():
>     ...
>             text="%s\n%s\n%s %s\n%s" % (nombre_ella.decode('UTF-8'), ...)
>             pdf.add_label(text)
>     response.headers['Content-Type'] = 'application/pdf'
>     return pdf.output(dest='S')
>
>
> It works for me with any kind of symbol, including spanish ñ.
>
> Regards
>
>
> 2012/1/1 Martin Weissenboeck <[email protected]>:
> > Now I have found that I have to convert the string:
> >
> > txt = 'äöü ß ÄÖÜ'
> > txt = txt.decode('utf-8').encode('latin-1','replace')
> >
> >
> > This new string will be written correctly into the pdf-file.Is there a
> > better way?
> > No chance for the Euro-currency-symbol '€'....
> >
> > Maybe there will be a full unicode characterset for pyfpdf in the future.
> >
> >
> > 2012/1/1 Martin Weissenboeck <[email protected]>
> >>
> >> Another question about pyfpdf:
> >>
> >> Is there any chance to get some more utf-8-characters?
> >> (I have asked this some months ago).
> >>
> >> It seems, that pyfpdf only supports the basic ascii character set and no
> >> latin-1-characters.
> >> I want to use äöü ß ÄÖÜ €...and so on.
> >>
> >> Regards, Martin
> >>
> >
>

Reply via email to