[reportlab-users] Chinese text (unicode) is not shown in acrobat ( with asian font support ) but is correctly rendered with other interpreters (ghostview)
Thu, 11 Sep 2003 01:01:59 +0300
Content-Type: text/plain; charset=iso-8859-1
On Wed, Sep 10, 2003 at 12:16:55PM +0200, Ismael Canales Luis wrote:
> The font that I use is the ttf mingliu.
> My code is something like.
> class card( canvas.Canvas ) :
You need to pass a UTF-8 encoded simple string, and not a Unicode
string. If you really do have a Unicode string, say, in a variable
called `s', you could write
canvas.Canvas.drawString(5.0805*mm, 22.5*mm, s.encode('UTF-8'))
But the string you used does not look Chinese to me. It is a sequence
of the following Unicode characters:
U+00E5 =E5 LATIN SMALL LETTER A WITH RING ABOVE
U+00BC =BC VULGAR FRACTION ONE QUARTER
U+00B5 =B5 MICRO SIGN
U+00E7 =E7 LATIN SMALL LETTER C WITH CEDILLA
If the text is already encoded in UTF-8, just drop the u prefix. If it
is encoded in some other encoding, you need to recode it to UTF-8.
AFAIU there are plans to support Unicode strings directly in future
versions of Reportlab (once Python 1.5.2 compatibility is dropped).
> Could somebody help me ? what is happen here ?
It would be a good idea to say what results you saw and what your
The *REAL* Y2K is the year 2048.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
-----END PGP SIGNATURE-----