diff --git a/monitor/filter_exception_decoder.py b/monitor/filter_exception_decoder.py index 92d41fe..471d809 100644 --- a/monitor/filter_exception_decoder.py +++ b/monitor/filter_exception_decoder.py @@ -18,7 +18,7 @@ import sys from platformio.commands.device import DeviceMonitorFilter -from platformio.compat import get_filesystem_encoding, path_to_unicode +from platformio.compat import path_to_unicode, WINDOWS, PY2 from platformio.project.exception import PlatformioException from platformio.project.helpers import load_project_ide_data @@ -251,18 +251,24 @@ def take_stack_lines(self): def get_lines(self, addresses): result = [] - enc = get_filesystem_encoding() - args = (self.addr2line_path, "-fipC", "-e", self.firmware_path) - args = [a.encode(enc) for a in args] + + enc = "mbcs" if WINDOWS else "utf-8" + args = [self.addr2line_path, u"-fipC", u"-e", self.firmware_path] + if PY2: + args = [a.encode(enc) for a in args] + for addr in addresses: if not self.is_addr_ok(addr): result.append(None) continue + if PY2: + addr = addr.encode(enc) + to_append = None try: output = ( - subprocess.check_output(args + [addr.encode(enc)]) + subprocess.check_output(args + [addr]) .decode(enc) .strip() )