diff options
author | Peter Murphy <peterkmurphy@gmail.com> | 2017-05-08 16:39:26 +1000 |
---|---|---|
committer | Peter Murphy <peterkmurphy@gmail.com> | 2017-05-08 16:39:26 +1000 |
commit | cf1c86cb86db74206085e6f83e4586ddc7db9ac2 (patch) | |
tree | 438cc3c30c8afafee3a68b421830a10583439f64 /lib3 | |
parent | a06c1f644b0ba3298efb7b6ec928aaa9221b52b8 (diff) | |
download | pyyaml-cf1c86cb86db74206085e6f83e4586ddc7db9ac2.tar.gz |
First attack at pyyaml does not support literals in unicode over codepoint 0xffff #25
Diffstat (limited to 'lib3')
-rw-r--r-- | lib3/yaml/emitter.py | 6 | ||||
-rw-r--r-- | lib3/yaml/reader.py | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/lib3/yaml/emitter.py b/lib3/yaml/emitter.py index 34cb145..3479883 100644 --- a/lib3/yaml/emitter.py +++ b/lib3/yaml/emitter.py @@ -671,7 +671,7 @@ class Emitter: # Check for indicators. if index == 0: # Leading indicators are special characters. - if ch in '#,[]{}&*!|>\'\"%@`': + if ch in '#,[]{}&*!|>\'\"%@`': flow_indicators = True block_indicators = True if ch in '?:': @@ -698,7 +698,8 @@ class Emitter: line_breaks = True if not (ch == '\n' or '\x20' <= ch <= '\x7E'): if (ch == '\x85' or '\xA0' <= ch <= '\uD7FF' - or '\uE000' <= ch <= '\uFFFD') and ch != '\uFEFF': + or '\uE000' <= ch <= '\uFFFD' + or '\U00010000' <= ch < '\U0010ffff') and ch != '\uFEFF': unicode_characters = True if not self.allow_unicode: special_characters = True @@ -1134,4 +1135,3 @@ class Emitter: spaces = (ch == ' ') breaks = (ch in '\n\x85\u2028\u2029') end += 1 - diff --git a/lib3/yaml/reader.py b/lib3/yaml/reader.py index f70e920..376b9a3 100644 --- a/lib3/yaml/reader.py +++ b/lib3/yaml/reader.py @@ -134,7 +134,7 @@ class Reader(object): self.encoding = 'utf-8' self.update(1) - NON_PRINTABLE = re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]') + NON_PRINTABLE = re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]') def check_printable(self, data): match = self.NON_PRINTABLE.search(data) if match: @@ -189,4 +189,3 @@ class Reader(object): # psyco.bind(Reader) #except ImportError: # pass - |