summaryrefslogtreecommitdiff
path: root/reader.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2016-09-05 14:27:36 +0200
committerAnthon van der Neut <anthon@mnt.org>2016-09-05 14:27:36 +0200
commit54efef321b8aad0552280153fbc698f88d3d4a9f (patch)
tree654e02c3d6ab3f32d5ab43b7a1f17772de5f3473 /reader.py
parent8b6f344a87ee816be1fdef0c31f350745b6606d6 (diff)
downloadruamel.yaml-54efef321b8aad0552280153fbc698f88d3d4a9f.tar.gz
32 bit unicode not supported on MacOS, fixes issue #560.12.9
reported by (David Tagatac)
Diffstat (limited to 'reader.py')
-rw-r--r--reader.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/reader.py b/reader.py
index fe6f505..fc52d2e 100644
--- a/reader.py
+++ b/reader.py
@@ -24,7 +24,7 @@ import codecs
import re
from ruamel.yaml.error import YAMLError, Mark
-from ruamel.yaml.compat import text_type, binary_type, PY3
+from ruamel.yaml.compat import text_type, binary_type, PY3, UNICODE_SIZE
__all__ = ['Reader', 'ReaderError']
@@ -144,13 +144,21 @@ class Reader(object):
self.encoding = 'utf-8'
self.update(1)
- NON_PRINTABLE = re.compile(
- u'[^\x09\x0A\x0D\x20-\x7E\x85'
- u'\xA0-\uD7FF'
- u'\uE000-\uFFFD'
- u'\U00010000-\U0010FFFF'
- u']'
- )
+ if UNICODE_SIZE == 4:
+ NON_PRINTABLE = re.compile(
+ u'[^\x09\x0A\x0D\x20-\x7E\x85'
+ u'\xA0-\uD7FF'
+ u'\uE000-\uFFFD'
+ u'\U00010000-\U0010FFFF'
+ u']'
+ )
+ else:
+ NON_PRINTABLE = re.compile(
+ u'[^\x09\x0A\x0D\x20-\x7E\x85'
+ u'\xA0-\uD7FF'
+ u'\uE000-\uFFFD'
+ u']'
+ )
def check_printable(self, data):
match = self.NON_PRINTABLE.search(data)