diff options
Diffstat (limited to 'share/extensions')
| -rwxr-xr-x | share/extensions/new_glyph_layer.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/share/extensions/new_glyph_layer.py b/share/extensions/new_glyph_layer.py index 7261baa2d..d6622cc62 100755 --- a/share/extensions/new_glyph_layer.py +++ b/share/extensions/new_glyph_layer.py @@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import inkex import sys +import locale + class NewGlyphLayer(inkex.Effect): def __init__(self): @@ -27,10 +29,13 @@ class NewGlyphLayer(inkex.Effect): action="store", type="string", dest="unicodechars", default='', help="Unicode chars") + self.encoding = sys.stdin.encoding + if self.encoding == 'cp0' or self.encoding is None: + self.encoding = locale.getpreferredencoding() def effect(self): # Get all the options - unicode_chars = self.options.unicodechars + unicode_chars = self.options.unicodechars.decode(self.encoding) #TODO: remove duplicate chars @@ -40,7 +45,7 @@ class NewGlyphLayer(inkex.Effect): for char in unicode_chars: # Create a new layer. layer = inkex.etree.SubElement(svg, 'g') - layer.set(inkex.addNS('label', 'inkscape'), 'GlyphLayer-'+char) + layer.set(inkex.addNS('label', 'inkscape'), u'GlyphLayer-'+char) layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer') layer.set('style', 'display:none') #initially not visible |
