El 16.10.2017 a las 11:17, Kornel Benko escribió:

Please replace the print statement
        print(SubstituteDataInLine(line[:-1]))
with
        sys.stdout.write(SubstituteDataInLine(line[:-1])+'\n')

This lead to
"python UnicodeEncodeError: 'charmap' codec can't encode character"

However, I found now the solution, see attached. I just put it into master.

Please give it a +1 for 2.3.x if you agree.

many thanks for all your help and best regards
Uwe
diff --git 
"a/C:\\Users\\Usti\\AppData\\Local\\Temp\\TortoiseGit\\ReplaceValues-cd5e2d5.001.py"
 "b/D:\\LyXGit\\2.3.x\\development\\cmake\\doc\\ReplaceValues.py"
index f07ce80bc9..41ed6e212c 100644
--- 
"a/C:\\Users\\Usti\\AppData\\Local\\Temp\\TortoiseGit\\ReplaceValues-cd5e2d5.001.py"
+++ "b/D:\\LyXGit\\2.3.x\\development\\cmake\\doc\\ReplaceValues.py"
@@ -13,6 +13,7 @@ from __future__ import print_function
 
 import sys
 import re
+import codecs
 
 Subst = {}  # map of desired substitutions
 prog = re.compile("")
@@ -33,8 +34,8 @@ def SubstituteDataInLine(line):
 
 
 def SubstituteDataInFile(InFile):
-    for line in open(InFile):
-        print(SubstituteDataInLine(line[:-1]))
+    for line in codecs.open(InFile, 'r', 'utf-8'):
+        print(SubstituteDataInLine(line[:-1]).encode("utf-8"))
 
 ##########################################
 

Reply via email to