From 4e124947a1b81afcc9c774b0678b296527911962 Mon Sep 17 00:00:00 2001 From: Andrea Gronchi Date: Sat, 28 Mar 2015 14:01:56 +0100 Subject: [PATCH] fix: handle builtin dictionaries as unicode data, not bytes. This prevents the generator outputting repr() of binary data, resulting in a sequence of b'blahblahs' --- loremipsum/generator.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/loremipsum/generator.py b/loremipsum/generator.py index ed43307..fc83dd9 100644 --- a/loremipsum/generator.py +++ b/loremipsum/generator.py @@ -22,9 +22,8 @@ # "hello" with a comma next to it) _WORD_DELIMITERS = [','] + _SENTENCE_DELIMITERS -_SAMPLE = resource_string(__name__, 'default/sample.txt') -_DICTIONARY = resource_string(__name__, 'default/dictionary.txt').split() - +_SAMPLE = unicode(resource_string(__name__, 'default/sample.txt'), encoding="utf-8") +_DICTIONARY = unicode(resource_string(__name__, 'default/dictionary.txt'), encoding="utf-8").split() _LOREM_IPSUM = 'lorem ipsum dolor sit amet, consecteteur adipiscing elit'