Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generate PDF with Tamil font problem

258 views
Skip to first unread message

sath...@e-ndicus.com

unread,
Mar 5, 2011, 12:20:25 AM3/5/11
to pytho...@python.org
Hi All,

I am using python's reportlab to print some unicode Tamil characters
'பே'. I added necessary unicode font to reportlab. But It
prints the output as 'ேப' (in reverse order). This issue
happens for multi-byte characters, whereas for character 'ப' is
printed as it is.
I am struggling to figure out the issue. Any help would see me on track.

Thank you,
--
SatheeshKumar. P
+91 99446 38595
+91 87544 15303
sath...@e-ndicus.com
psku...@gmail.com

Tom Zych

unread,
Mar 5, 2011, 6:58:53 AM3/5/11
to pytho...@python.org
sath...@e-ndicus.com wrote:
> I am using python's reportlab to print some unicode Tamil characters
> 'பே'. I added necessary unicode font to reportlab. But It
> prints the output as 'ேப' (in reverse order). This issue
> happens for multi-byte characters, whereas for character 'ப' is
> printed as it is.
> I am struggling to figure out the issue. Any help would see me on track.

Something similar came up on stackoverflow recently, though that was
with tkinter. Might shed some light.

http://stackoverflow.com/questions/5166488/

--
Tom Zych / freet...@pobox.com
"Would you like a lovely fluffy little white rabbit, little girl,
or a cutesy wootesly little brown rabbit?"
"Actually, I don't think my python would notice."

Robin Becker

unread,
Mar 8, 2011, 7:50:34 AM3/8/11
to sath...@e-ndicus.com, pytho...@python.org
On 05/03/2011 05:20, sath...@e-ndicus.com wrote:
> Hi All,

>
> I am using python's reportlab to print some unicode Tamil characters
> 'பே'. I added necessary unicode font to reportlab. But It
> prints the output as 'ேப' (in reverse order). This issue
> happens for multi-byte characters, whereas for character 'ப' is
> printed as it is.
> I am struggling to figure out the issue. Any help would see me on track.
.......

you can ask at the reportlab mailing list reportl...@reportlab.com; the use
of numeric entities is supported in paragraph text, but not in canvas.drawString
and similar. There you need to use either unicode or a utf8 encoded byte string.
--
Robin Becker

ccub...@gmail.com

unread,
Jun 12, 2017, 3:52:00 AM6/12/17
to
I am also facing the same problem with another similar Indian language- Malayalam. Has anybody encountered such issue and found any solution for this?

Steve D'Aprano

unread,
Jun 12, 2017, 7:18:24 AM6/12/17
to
On Mon, 12 Jun 2017 05:51 pm, ccub...@gmail.com wrote:

> On Saturday, 5 March 2011 10:50:25 UTC+5:30, sath...@e-ndicus.com wrote:
>> Hi All,
>>
>> I am using python's reportlab to print some unicode Tamil characters
>> 'பே'. I added necessary unicode font to reportlab. But It
>> prints the output as 'ேப' (in reverse order). This issue
>> happens for multi-byte characters, whereas for character 'ப' is
>> printed as it is.
>> I am struggling to figure out the issue. Any help would see me on track.
>>
>> Thank you,
[...]

> I am also facing the same problem with another similar Indian language-
> Malayalam. Has anybody encountered such issue and found any solution for this?

You are replying to a six year old message from 2011. I doubt anyone remembers
the details of that discussion.

Please show us a SIMPLE example of this issue.

If I try this, I get something which appears to be okay:

py> print('\u2986\u3015')
⦆〕

but they don't appear to be Tamil characters?

py> for c in '\u2986\u3015':
... unicodedata.name(c)
...
'RIGHT WHITE PARENTHESIS'
'RIGHT TORTOISE SHELL BRACKET'


Let me try this instead:

py> for c in (chr(2986), chr(3015)):
... unicodedata.name(c)
...
'TAMIL LETTER PA'
'TAMIL VOWEL SIGN EE'

That's better!

py> print(''.join([chr(2986), chr(3015)]))
பே


If you want help to diagnose and fix this, you will need to show us some simple
code demonstrating the problem. Also tell us what output you expect, and what
version of Python you are running.





--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

0 new messages