c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #01542
[Bug 664345] Re: FNC1 symbol in barcode
Hi, thanks for the report and providing the patch that works for you.
I guess this is yet another encoding conversion issue due to Python2.
BTW, hardcoding 'latin1' encoding is not a good idea in general, you
should use 'utf-8' instead. You might even directly put the "ñ"
character in your RML document then, as long as you configure your
editor to properly write the RML in UTF-8.
** Changed in: openobject-server
Importance: Undecided => Wishlist
** Changed in: openobject-server
Status: New => Confirmed
** Changed in: openobject-server
Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)
** Summary changed:
- FNC1 symbol in barcode
+ Non-ASCII characters not supported in RML barcodes
--
Non-ASCII characters not supported in RML barcodes
https://bugs.launchpad.net/bugs/664345
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
Status in OpenObject Server: Confirmed
Bug description:
Hello.
I make an RML report with barcode of "code128 " kind.
Is there a way to insert a special FNC1 symbol (field delimeter) in the barcode? This is required this because there are fields of variable length in barcode.
The Reportlab documentation says: "Code 128 is a very compact symbology that can encode the entire 128 character ASCII set, plus 4 special control codes, (FNC1-FNC4, expressed in the input string as \xf1 to \xf4)."
So Python code like "bar=code128.Code128("\xf412\xf134567890",xdim=100*mm)" works well.
But when i try to insert this symbol between <barCode> an </barCode> inside RML template i get:
File "reportlab\platypus\doctemplate.pyo", line 756, in build
File "reportlab\platypus\doctemplate.pyo", line 649, in handle_flowable
File "reportlab\platypus\frames.pyo", line 159, in _add
File "reportlab\platypus\flowables.pyo", line 121, in wrap
File "reportlab\graphics\barcode\common.pyo", line 107, in width
File "reportlab\graphics\barcode\common.pyo", line 57, in _calculate
File "reportlab\graphics\barcode\code128.pyo", line 243, in validate
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 0: ordinal not in range(128)
Tried to insert it many ways: ñ ñ; [['\xf1']] or [[u'xf1']]
I think something is wrong in trml2pdf.py... it transmits an unicode string where should be "simple" one
References