Content-Length: 80458 | pFad | https://gitlab.com/inkscape/extensions/-/merge_requests/363

flare Preserve unicode text elements with CallExtensions (!363) · Merge requests · Inkscape / extensions · GitLab
Skip to content

Preserve unicode text elements with CallExtensions

Benjamin Nanes requested to merge bnanes/inkscape-extensions:master into master

Running a CallExtension on an Inkscape document containing text elements with non-ASCII characters disrupts the text element contents when the system default encoding in not UTF-8. I think this is caused by the way the extension temporary output file is loaded in inkex/extensions.py lines 125-128. Specifically, the text stream is opened using system default encoding, but parsed using UTF-8 encoding:

       if self.output_ext == 'svg':
                with open(document, 'r') as fhl:
                    document = fhl.read()
                if '<' in document:
                    document = load_svg(document.encode('utf-8'))

Specifying UTF-8 encoding when opening the stream corrects the problem:

            if self.output_ext == 'svg':
                with open(document, 'r', encoding='utf-8') as fhl:
                    document = fhl.read()
                if '<' in document:
                    document = load_svg(document.encode('utf-8'))

Merge request reports

Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://gitlab.com/inkscape/extensions/-/merge_requests/363

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy