From 4a106181dd024bd8a33f9d3d646e602e75f42190 Mon Sep 17 00:00:00 2001 From: Cameron Ross Date: Tue, 27 Feb 2018 14:15:47 -0400 Subject: [PATCH] Add support for unicode chars in the 0x10000 - 0x10FFFF range as required by spec --- source/dyaml/reader.d | 3 ++- test/data/bmpchars.canonical | 6 ++++++ test/data/bmpchars.data | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/data/bmpchars.canonical create mode 100644 test/data/bmpchars.data diff --git a/source/dyaml/reader.d b/source/dyaml/reader.d index 3cfe69a..f7607f7 100644 --- a/source/dyaml/reader.d +++ b/source/dyaml/reader.d @@ -926,7 +926,8 @@ bool isPrintableValidUTF8(const char[] chars) @trusted pure nothrow @nogc const dchar c = decodeValidUTF8NoGC(chars, index); // We now c is not ASCII, so only check for printable non-ASCII chars. if(!(c == 0x85 || (c >= 0xA0 && c <= '\uD7FF') || - (c >= '\uE000' && c <= '\uFFFD'))) + (c >= '\uE000' && c <= '\uFFFD') || + (c >= '\U00010000' && c <= '\U0010FFFF'))) { return false; } diff --git a/test/data/bmpchars.canonical b/test/data/bmpchars.canonical new file mode 100644 index 0000000..9b77b57 --- /dev/null +++ b/test/data/bmpchars.canonical @@ -0,0 +1,6 @@ +%YAML 1.1 +--- +!!map { + ? !!str "a" + : !!str "ð’…—" +} diff --git a/test/data/bmpchars.data b/test/data/bmpchars.data new file mode 100644 index 0000000..28e948e --- /dev/null +++ b/test/data/bmpchars.data @@ -0,0 +1 @@ +a: ð’…— \ No newline at end of file