From: JazzyNico Date: Wed, 16 Dec 2009 20:31:01 +0000 (+0100) Subject: Embedimage extension fix and stderr Unicode support in inkex.py X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d5a7b3a6d34e9acfb667a16be92b46f684182d08;p=inkscape.git Embedimage extension fix and stderr Unicode support in inkex.py --- diff --git a/share/extensions/embedimage.py b/share/extensions/embedimage.py index 16439223b..f73ceb358 100644 --- a/share/extensions/embedimage.py +++ b/share/extensions/embedimage.py @@ -56,9 +56,8 @@ class Embedder(inkex.Effect): if xlink is None or xlink[:5] != 'data:': absref=node.get(inkex.addNS('absref','sodipodi')) url=urlparse.urlparse(xlink) - href=urllib.unquote(url.path) - if os.name == 'nt' and href[0] == '/': - href = href[1:] + href=urllib.url2pathname(url.path) + path='' #path selection strategy: # 1. href if absolute @@ -70,6 +69,8 @@ class Embedder(inkex.Effect): if (absref != None): path=absref + path=unicode(path, "utf-8") + if (not os.path.isfile(path)): inkex.errormsg(_('No xlink:href or sodipodi:absref attributes found, or they do not point to an existing file! Unable to embed image.')) if path: diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index d36820692..1a70c25d6 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -84,7 +84,7 @@ def errormsg(msg): ... inkex.errormsg(_("This extension requires two selected paths.")) """ - sys.stderr.write((str(msg) + "\n").encode("UTF-8")) + sys.stderr.write((unicode(msg) + "\n").encode("UTF-8")) def check_inkbool(option, opt, value): if str(value).capitalize() == 'True':