diff --git a/pybootchartgui/parsing.py b/pybootchartgui/parsing.py index b9c4020..936dd52 100644 --- a/pybootchartgui/parsing.py +++ b/pybootchartgui/parsing.py @@ -27,6 +27,9 @@ from functools import reduce from .samples import * from .process_tree import ProcessTree +VALID_CHARS = ''.join(map(unichr, range(0,127))) +INVALID_CHARS_RE = re.compile('[^%s]' % re.escape(VALID_CHARS)) + # Parsing produces as its end result a 'Trace' class Trace: @@ -221,6 +224,7 @@ class ParseError(Exception): def _parse_headers(file): """Parses the headers of the bootchart.""" def parse(acc, line): + line = INVALID_CHARS_RE.sub('', line) (headers, last) = acc if '=' in line: last, value = map (lambda x: x.strip(), line.split('=', 1))