From 2415c6200ebdba75a0571d71a4569f18153fff57 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Thu, 18 Apr 2013 10:46:22 -0400 Subject: [PATCH] Fixes #1879: Properly decode filenames that we get from fc-match --- lib/matplotlib/font_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index aa6fa1665b08..b5da12d8a6d7 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -1289,11 +1289,12 @@ def fc_match(pattern, fontext): if pipe.returncode == 0: for match in _fc_match_regex.finditer(output): file = match.group(1) + file = file.decode(sys.getfilesystemencoding()) if os.path.splitext(file)[1][1:] in fontexts: return file return None - _fc_match_regex = re.compile(r'\sfile:\s+"([^"]*)"') + _fc_match_regex = re.compile(rb'\sfile:\s+"([^"]*)"') _fc_match_cache = {} def findfont(prop, fontext='ttf'):