Closed heuer closed 9 years ago
Fixed in 1.1
Unicode data work in python2 but python3 seems to crash.
See examples below.
$ python2
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyqrcode
>>> pyqrcode.create('John’s Pizza')
QRCode(content=u'John\u7ab6\u51b1 Pizza', error='H', version=2, mode='binary')
$ python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyqrcode
>>> pyqrcode.create('John’s Pizza')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/pyqrcode/__init__.py", line 111, in create
return QRCode(content, error, version, mode, encoding)
File "/usr/local/lib/python3.6/dist-packages/pyqrcode/__init__.py", line 161, in __init__
self.data = content.encode(self.encoding)
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2019' in position 4: ordinal not in range(256)