python - Unicode handling in ReportLab -


I am trying to use ReportLab with Unicode characters, but this is not working. I tried to trace through the code until reaching the following line:

  class TTFont: # ... def splitString (auto, text, doctor, encoding = 'UTF-8') : #. .. cur.append (n & amp; 0xFF) # & lt; - Here's the problem! (This code can be found in the repository of this code, in the file, in the query line 1059.)  

Why is the value of n being tampered with ?!

In the row shown above, code is the code point of the character to be processed (e.g. 65 for 'A', 'A' 97, or 1588 for Arabic Sheen 'Shi'). cur is a list that is filled with characters to be sent to the final output (AFIU). Before that line, everything (apparently) was working fine, but in this line, the value of n was increased, apparently subtracting it into extended ASCII category!

-I lose the value of ASCII, Unicode characters, I do not understand why this statement is useful, or why it is necessary!

So my question is, why the value of n is being tampered with here, and how should I proceed to fix this problem?

Edit:
In response to a comment regarding my code snippet, this is an example that causes this error:

  my_doctemplate.build ([Paragraph (bullettext = none, encoding = 'UTF8', case-sensitive = 1, debug = 0, text = '\ xd8 \ xa3 \ xd8 \ xa8 \ xd8 \ xb1 \ xd8 \ xa7 \ Xd8 \ xac ', frags = [paratroag (fontname =' devisisdomo-bold obik ', text =' \ xd8 \ xa3 \ xd8 \ xa8 \ xd8 \ xb1 \ xd8 \ xa7 \ xd8 \ xac ', sub = 0, increase = 0, Greek = 0, Link = None, Ital C = 0, Strike = 0, Font Size = 12.0, Text Color = Color (0,0,0), Super = 0, Underlined = 0, Bold = 0)]))))  

This is called PDFTextObject._textOut , _formattext , which recognizes the font as _dynamicFont , and accordingly calls Font .splitStri ng , which is causing the error described above

What do you mean, "not working"? You have incorrectly reported the report source code what it is actually doing that the lower and upper byte of each 16-bit Unicode character is coded separately (the upper byte is written only when it changes, PDF seems to be customizable to make documents smaller). / P>

Please explain what is the problem is , not what you think is the underlying cause. It's likely that the characters you want to display are not present in the selected font only ('DejaVuSansMono-BoldOblique').


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -