diff --git a/out_of_tree/parsed_notifications.zip b/out_of_tree/parsed_notifications.zip index 876b6c9..ee16911 100644 Binary files a/out_of_tree/parsed_notifications.zip and b/out_of_tree/parsed_notifications.zip differ diff --git a/pydoc_injections2.txt b/pydoc_injections2.txt index 36e43fd..0c32577 100644 --- a/pydoc_injections2.txt +++ b/pydoc_injections2.txt @@ -16921,7 +16921,8 @@ class Hexrays_Hooks(__builtin__.object) | | func_printed(self, *args) | Function text has been generated. Plugins may modify the text in - | 'cfunc_t::sv' . + | 'cfunc_t::sv' . The text uses regular color codes (see 'lines.hpp' ) + | COLOR_ADDR is used to store pointers to ctree elements. | | func_printed(self, cfunc) -> int | @param cfunc (C++: cfunc_t *) @@ -17102,9 +17103,9 @@ class Hexrays_Hooks(__builtin__.object) | Decompiled text is ready. | | text_ready(self, vu) -> int - | @param vu: This event can be used to modify the output text (sv). The - | text uses regular color codes (see lines.hpp) COLOR_ADDR is - | used to store pointers to ctree elements (C++: vdui_t *) + | @param vu: This event can be used to modify the output text (sv). + | Obsolete. Please use hxe_func_printed instead. (C++: + | vdui_t *) | | unhook(self, *args) | unhook(self) -> bool diff --git a/pydoc_injections3.txt b/pydoc_injections3.txt index a32025e..9c86103 100644 --- a/pydoc_injections3.txt +++ b/pydoc_injections3.txt @@ -16894,7 +16894,8 @@ class Hexrays_Hooks(builtins.object) | | func_printed(self, *args) -> 'int' | Function text has been generated. Plugins may modify the text in - | 'cfunc_t::sv' . + | 'cfunc_t::sv' . The text uses regular color codes (see 'lines.hpp' ) + | COLOR_ADDR is used to store pointers to ctree elements. | | func_printed(self, cfunc) -> int | @param cfunc (C++: cfunc_t *) @@ -17075,9 +17076,9 @@ class Hexrays_Hooks(builtins.object) | Decompiled text is ready. | | text_ready(self, vu) -> int - | @param vu: This event can be used to modify the output text (sv). The - | text uses regular color codes (see lines.hpp) COLOR_ADDR is - | used to store pointers to ctree elements (C++: vdui_t *) + | @param vu: This event can be used to modify the output text (sv). + | Obsolete. Please use hxe_func_printed instead. (C++: + | vdui_t *) | | unhook(self, *args) -> 'bool' | unhook(self) -> bool @@ -17139,7 +17140,8 @@ class __cbhooks_t(Hexrays_Hooks) | | func_printed(self, *args) | Function text has been generated. Plugins may modify the text in - | 'cfunc_t::sv' . + | 'cfunc_t::sv' . The text uses regular color codes (see 'lines.hpp' ) + | COLOR_ADDR is used to store pointers to ctree elements. | | func_printed(self, cfunc) -> int | @param cfunc (C++: cfunc_t *) @@ -17215,9 +17217,9 @@ class __cbhooks_t(Hexrays_Hooks) | Decompiled text is ready. | | text_ready(self, vu) -> int - | @param vu: This event can be used to modify the output text (sv). The - | text uses regular color codes (see lines.hpp) COLOR_ADDR is - | used to store pointers to ctree elements (C++: vdui_t *) + | @param vu: This event can be used to modify the output text (sv). + | Obsolete. Please use hxe_func_printed instead. (C++: + | vdui_t *) | | ---------------------------------------------------------------------- | Data and other attributes defined here: diff --git a/pywraps/py_idaapi.py b/pywraps/py_idaapi.py index 01d371e..5fd26ee 100644 --- a/pywraps/py_idaapi.py +++ b/pywraps/py_idaapi.py @@ -466,9 +466,20 @@ def IDAPython_ExecScript(script, g, print_error=True): g[FILE_ATTR] = script try: - with open(script) as fin: - code = compile(fin.read(), script, 'exec') - exec(code, g) + with open(script, "rb") as fin: + raw = fin.read() + encoding = "UTF-8" # UTF-8 by default: https://www.python.org/dev/peps/pep-3120/ + + # Look for a 'coding' comment + encoding_pat = re.compile(r'\s*#.*coding[:=]\s*([-\w.]+).*') + for line in raw.decode("ASCII", errors='replace').split("\n"): + match = encoding_pat.match(line) + if match: + encoding = match.group(1) + break + + code = compile(raw.decode(encoding), script, 'exec') + exec(code, g) PY_COMPILE_ERR = None except Exception as e: PY_COMPILE_ERR = "%s\n%s" % (str(e), traceback.format_exc())