diff options
| author | Karl Cheng <qantas94heavy@gmail.com> | 2019-05-17 07:40:10 +0000 |
|---|---|---|
| committer | Karl Cheng <qantas94heavy@gmail.com> | 2019-05-17 11:51:11 +0000 |
| commit | 5af7c48b76091a0a4ed19e326371eaa87790bd80 (patch) | |
| tree | 52234c33dd070d75a729af880bb3f5f9eddeaa63 /src/inkscape-main.cpp | |
| parent | Fix a compiling issue and add some improvements (diff) | |
| download | inkscape-5af7c48b76091a0a4ed19e326371eaa87790bd80.tar.gz inkscape-5af7c48b76091a0a4ed19e326371eaa87790bd80.zip | |
Ask Python extensions to return UTF-8 data
By default, Python 2.x will encode output as ASCII to STDOUT/STDERR if
the output is piped. This commit explicitly requests UTF-8 output by
setting the PYTHONIOENCODING environment variable.
Note this will not fix text encoding problems where the extension itself
does not support Unicode properly.
Refs: https://gitlab.com/inkscape/extensions/merge_requests/90
Diffstat (limited to '')
| -rw-r--r-- | src/inkscape-main.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/inkscape-main.cpp b/src/inkscape-main.cpp index aac164b37..8473795c1 100644 --- a/src/inkscape-main.cpp +++ b/src/inkscape-main.cpp @@ -48,6 +48,9 @@ static void set_extensions_env() g_setenv("PYTHONPATH", new_pythonpath.c_str(), true); + // Python 2.x attempts to encode output as ASCII by default when sent to a pipe. + g_setenv("PYTHONIOENCODING", "UTF-8", true); + #ifdef _WIN32 // add inkscape directory to DLL search path so dynamically linked extension modules find their libraries // should be fixed in Python 3.8 (https://github.com/python/cpython/commit/2438cdf0e932a341c7613bf4323d06b91ae9f1f1) |
