Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Force UTF-8 character coding #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions inkscape_qrcode/qrcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"""
from __future__ import absolute_import, unicode_literals
import inkex
import locale
try:
from ._segno import encoder, utils
except (ImportError, ValueError):
Expand Down Expand Up @@ -73,6 +74,9 @@ def effect(self):
micro = True
boost_error = opts.boost_error == 'true'
want_background = opts.background == 'true'
input_encoding = locale.getdefaultlocale()[1]
if input_encoding and input_encoding != 'UTF-8':
opts.data = unicode(opts.data, input_encoding).encode('utf8')
if not micro and opts.symbol_count > 1:
qrs = encoder.encode_sequence(opts.data, version=version, error=error,
encoding=encoder, boost_error=boost_error,
Expand Down