mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Check for valid UTF-8 unconditionally.
The input script must be encoded in UTF-8. We had a check that was only activated when the preprocessor was called. Activate it always, as not doing so triggers an unhandled exception later on.
This commit is contained in:
parent
6f474c09d2
commit
b76063821b
1 changed files with 14 additions and 13 deletions
7
main.py
7
main.py
|
@ -471,9 +471,6 @@ def main(argv):
|
|||
preproc_cmdline.append('-D__OPTIMIZER__=LSL PyOptimizer')
|
||||
preproc_cmdline.append('-D__OPTIMIZER_VERSION__=' + VERSION)
|
||||
|
||||
if preproc != 'none':
|
||||
# At this point, for the external preprocessor to work we need the
|
||||
# script as a byte array, not as unicode, but it should be valid UTF-8.
|
||||
if type(script) is unicode:
|
||||
script = script.encode('utf8')
|
||||
else:
|
||||
|
@ -487,6 +484,10 @@ def main(argv):
|
|||
# displaying invalid UTF-8
|
||||
sys.stderr.write(e[0] + '\n')
|
||||
return 1
|
||||
|
||||
if preproc != 'none':
|
||||
# At this point, for the external preprocessor to work we need the
|
||||
# script as a byte array, not as unicode, but it should be valid UTF-8.
|
||||
script = PreparePreproc(script)
|
||||
if mcpp_mode:
|
||||
# As a special treatment for mcpp, we force it to output its macros
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue