From 93471e250ef13612ff2b5aadcf0c2083aa762cc0 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 10 Feb 2015 10:44:41 +0200 Subject: Support utf-8 input --- NEWS | 3 +++ simple.scenario | 2 ++ yarnlib/mdparser.py | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 093c6b8..8221d58 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,9 @@ Version 0.14, released UNRELEASED * Yarn now supports continuation lines: start a line with `...` and it continues the previous line. +* Yarn now works with UTF-8 input. No other character sets are + supported; sorry (but patches welcome). + Version 0.12, released 2014-03-28 --------------------------------- diff --git a/simple.scenario b/simple.scenario index a244d88..a8bc7bb 100644 --- a/simple.scenario +++ b/simple.scenario @@ -15,6 +15,8 @@ The following is the actual test in this scenario: AND not all is well FINALLY cleanup +We also support some non-ASCII text: älämölö. + And the implementations follow. IMPLEMENTS GIVEN a clean slate diff --git a/yarnlib/mdparser.py b/yarnlib/mdparser.py index f787293..4bd59d3 100644 --- a/yarnlib/mdparser.py +++ b/yarnlib/mdparser.py @@ -72,5 +72,6 @@ class MarkdownParser(object): def parse_file(self, filename): # pragma: no cover with open(filename) as f: - return self.parse_string(f.read()) - + binary = f.read() + text = binary.decode('utf-8') + return self.parse_string(text) -- cgit v1.2.1