mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Fix bug with scripts that have UTF-8 characters.
The parser expects bytes, not unicode.
This commit is contained in:
parent
621b29b0cc
commit
faf296fa74
1 changed files with 3 additions and 7 deletions
|
@ -2252,14 +2252,10 @@ list lazy_list_set(list L, integer i, list v)
|
||||||
This function also builds the temporary globals table.
|
This function also builds the temporary globals table.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.script = script # needed here so there's a .script property for EParse in case of exception in decode()
|
if type(script) is unicode:
|
||||||
if type(script) is not unicode:
|
script = script.encode('utf8')
|
||||||
try:
|
|
||||||
self.script = script.decode('utf8')
|
|
||||||
except UnicodeDecodeError as E:
|
|
||||||
self.errorpos = E.start
|
|
||||||
raise EParse(self, 'Invalid UTF-8 in script')
|
|
||||||
|
|
||||||
|
self.script = script
|
||||||
self.length = len(script)
|
self.length = len(script)
|
||||||
|
|
||||||
# Extended expressions in globals (needs support from the optimizer to work)
|
# Extended expressions in globals (needs support from the optimizer to work)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue