1+ # -*- coding: utf-8 -*-
2+
13import sys
24import os
35import json
810 os .path .dirname (os .path .realpath (__file__ )),
911 '../python/ext-libs' ))
1012
11- from six import string_types
12-
13- cpp = open (sys .argv [1 ], "w" )
13+ cpp = open (sys .argv [1 ], "w" , encoding = "utf-8" )
1414cpp .write (
1515 "#include \" qgsexpression.h\" \n "
1616 "\n "
@@ -31,7 +31,7 @@ def quote(v):
3131 elif isinstance (v , list ):
3232 return map (quote , v )
3333
34- elif isinstance (v , string_types ):
34+ elif isinstance (v , str ):
3535 return v .replace ('"' , '\\ "' ).replace ('\n ' , '\\ n' )
3636
3737 elif isinstance (v , bool ):
@@ -42,7 +42,7 @@ def quote(v):
4242
4343
4444for f in sorted (glob .glob ('resources/function_help/json/*' )):
45- with open (f ) as function_file :
45+ with open (f , encoding = "utf-8" ) as function_file :
4646 try :
4747 json_params = json .load (function_file )
4848 except :
@@ -103,7 +103,7 @@ def quote(v):
103103
104104 if 'examples' in v :
105105 for e in v ['examples' ]:
106- cpp .write ("\n << HelpExample( tr( \" {0}\" ), tr( \" {1}\" ), tr( \" {2}\" ) )" .format (
106+ cpp .write ("\n << HelpExample( tr( \" {0}\" ), tr( \" {1}\" ), tr( \" {2}\" ) )" .format (
107107 e ['expression' ],
108108 e ['returns' ],
109109 e .get ('note' , '' ))
0 commit comments