Reviewers: hanwenn, Message: On 2020/04/12 12:36:22, hanwenn wrote: > LGTM > > shortcut push? I can update the scripts afterwards.
commit 23dbc2090b1f45ae26c7f88af6945bde00cb2ddd Author: Jonas Hahnfeld <hah...@hahnjo.de> Date: Sun Apr 12 14:11:37 2020 +0200 weblinks: Fix encoding of link texts in staging Description: weblinks: Fix encoding of link texts When switching to Python 3, I added the call of .encode('utf-8') to fix the build with Python 3.5. This converts all link texts into binary encoding, enclosed by b'...'. The correct fix is to force utf-8 encoding for sys.stdout. See e0c78a4c71 ("Use codecs.open() to decode as utf-8") for more details on this issue and how the default changes with Python 3.7. Please review this at https://codereview.appspot.com/563860043/ Affected files (+8, -3 lines): M scripts/build/create-weblinks-itexi.py Index: scripts/build/create-weblinks-itexi.py diff --git a/scripts/build/create-weblinks-itexi.py b/scripts/build/create-weblinks-itexi.py index f05e6f33e484fe0f877ccd11fe9851c3cb48fce7..5ac03a3c07a140437f9c71746351446183bd0c7e 100644 --- a/scripts/build/create-weblinks-itexi.py +++ b/scripts/build/create-weblinks-itexi.py @@ -5,9 +5,14 @@ """ when being called on lilypond.org, pass it the location of the top source dir on the command-line. """ -import sys -import os +import codecs import glob +import os +import sys + +# Force encoding for stdout, Python up to version 3.7 falls back to +# ASCII with LANG=C (which the build system exports). +sys.stdout = codecs.getwriter ('utf8') (sys.stdout.detach ()) ### translation data -- shouldn't be here; see issue ### https://sourceforge.net/p/testlilyissues/issues/1050/ @@ -425,7 +430,7 @@ def macroLang(name, lang): def make_macro(name, string): print("@macro", name) - print(string.encode('utf-8')) + print(string) print("@end macro") print("")