QR-Code generator crashes because of Unicode.

Bug #929001 reported by Steve
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Unassigned
0.92.x
Fix Released
Undecided
Unassigned

Bug Description

Inkscape 0.48+devel r10948
Windows 7 Pro 64bit

Example: "Żółty"

Full message:

Traceback (most recent call last):
  File "render_barcode_qrcode.py", line 1068, in <module>
    e.affect()
  File "C:\Users\User\AppData\Local\Temp\Rar$EX00.713\inkscape\share\extensions\inkex.py", line 227, in affect
    self.effect()
  File "render_barcode_qrcode.py", line 1058, in effect
    grp = inkex.etree.SubElement(self.current_layer, 'g', grp_attribs) #the group to put everything in
  File "lxml.etree.pyx", line 2437, in lxml.etree.SubElement (src/lxml/lxml.etree.c:47345)
  File "apihelpers.pxi", line 210, in lxml.etree._makeSubElement (src/lxml/lxml.etree.c:11391)
  File "apihelpers.pxi", line 205, in lxml.etree._makeSubElement (src/lxml/lxml.etree.c:11327)
  File "apihelpers.pxi", line 283, in lxml.etree._initNodeAttributes (src/lxml/lxml.etree.c:12162)
  File "apihelpers.pxi", line 1242, in lxml.etree._utf8 (src/lxml/lxml.etree.c:19848)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes

Steve (stefan-padlo)
description: updated
su_v (suv-lp)
tags: added: extensions-plugins
Revision history for this message
su_v (suv-lp) wrote :

Reproduced with Inkscape 0.48+devel r10951 on OS X Lion, Python 2.7.2

Related earlier reports (same error, already fixed):
Bug #320496 “Calendar extension doesn't work”
Bug #366227 “impossible to open / import DXF in linux”:

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Alvin Penner (apenner) wrote :

attached are modified versions of the files for render_barcode_qrcode. This implements character encoding the same as for dxf input.py. These files need to be copied into the share\extensions directory.

Revision history for this message
Alvin Penner (apenner) wrote :

also the .inx file

Revision history for this message
Alvin Penner (apenner) wrote :

committed to rev 10970

Changed in inkscape:
status: Confirmed → Fix Committed
Revision history for this message
Steve (stefan-padlo) wrote :

Inkscape 0.48+devel r10990 still doesn't fix this problem.

Testing phrase: późną nocą grań olśniła księżyca jasność

Decoding : ZXing Decoder Online ; Barcode Scanner @ Android

Latin1, CP 1250, CP 1252 : code generated, but polish special signs are encoded in wrong way
UTF8 : crash with message:

Traceback (most recent call last):
  File "render_barcode_qrcode.py", line 1072, in <module>
    e.affect()
  File "C:\Program Files (x86)\Inkscape\share\extensions\inkex.py", line 230, in affect
    self.effect()
  File "render_barcode_qrcode.py", line 1056, in effect
    so.TEXT = unicode(so.TEXT, so.input_encode)
  File "C:\Program Files (x86)\Inkscape\python\Lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1-4: invalid data

Revision history for this message
su_v (suv-lp) wrote :

> Inkscape 0.48+devel r10990 still doesn't fix this problem.
>
> Testing phrase: późną nocą grań olśniła księżyca jasność
(…)
> UTF8 : crash with message:

Python crash not reproduced with provided sample string and encoding set to 'UTF-8',
using Inkscape 0.48+devel r10992 on OS X 10.7.2 with Python 2.7.2

(produced QR-Code not verified)

Revision history for this message
Alvin Penner (apenner) wrote :

unfortunately, I am having the same problem on Windows XP, Inkscape rev 10966.
<offtopic> the crash with utf-8 encoding on Windows is not necessarily a problem, it just means that some other encoding should have been chosen. For example, if you use the calendar extension and use some non-ascii text and use utf-8 encoding you will (on Windows) get a somewhat more graceful message saying 'You must select a correct system encoding', which means the same as the above crash</offtopic>.

 However, the conversion should work properly with some other encoding like Latin 1. With some non-ascii text, like '¼¾èê' the conversion appears to work with Latin 1. This was confirmed by opening the XML editor and checking the inkscape:label property which contains the text. Other text like 'późną' does not appear to be correct. This was confirmed by running the extension Render->Calendar and confirming that this text was not correct. The Calendar extension has a much wider variety of encodings to choose from, but I was not able to get any of them to convert this text correctly. (I didn't try them all, but I tried about half of them)

Changed in inkscape:
status: Fix Committed → New
Revision history for this message
Alvin Penner (apenner) wrote :

AImed, just for curiosity, what code page are you using on your computer? Mine is 850. I go to DOS and type in the command chcp and get:

C:\>chcp
Active code page: 850

Revision history for this message
Steve (stefan-padlo) wrote :

Aktywna strona kodowa: 852

Revision history for this message
Alvin Penner (apenner) wrote :

thanks, I tried using the encoding IBM852 in the Calendar extension to see if that would help, but that also does not work properly with this text, as far as I can tell.

Revision history for this message
Steve (stefan-padlo) wrote :

With dev version R11265 the problem still exists.

jazzynico (jazzynico)
Changed in inkscape:
status: New → Triaged
Revision history for this message
Parcly Taxel (parclytaxel-deactivatedaccount) wrote :

Not reproduced on Inkscape 0.91+devel r on Trisquel 7.0. Both "Żółty" and "Zolty" work fine.

Revision history for this message
Parcly Taxel (parclytaxel-deactivatedaccount) wrote :

I hasten to add! I was using r13779.

Revision history for this message
jazzynico (jazzynico) wrote :

Tested again on Windows XP, Inkscape trunk rev. 13791. I can't reproduce the original issue, but confirm the one reported comment #5.

su_v (suv-lp)
tags: added: win32
Revision history for this message
Qantas94Heavy (qantas94heavy) wrote :

I can't reproduce this any more with Inkscape 1.0alpha (d666cd1a10, 2019-05-16), both Latin-1 and UTF-8 work correctly.

With Inkscape 0.92.4 can still reproduce incorrect encoding with UTF-8 in comment 5, but does not show any error message. Latin-1 works correctly.

Closed by: https://gitlab.com/Qantas94Heavy

Changed in inkscape:
milestone: none → 1.0
status: Triaged → Fix Committed
tags: added: backport-proposed
removed: win32
tbnorth (terry-n-brown)
tags: added: bug-migration
Max Gaukler (mgmax)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.