diff options
author | Christian Rasmussen <christian.rasmussen@me.com> | 2022-03-12 00:44:44 +0100 |
---|---|---|
committer | Christian Rasmussen <christian.rasmussen@me.com> | 2022-03-12 02:59:20 +0100 |
commit | 52c36fa7a6a6cb81f0c068892de5b1553015e57c (patch) | |
tree | 2489a6e068e5bcf95853122e00bbcdab23f41b23 /lib | |
parent | 2f0bf4fbd45acc9f6815b4acfb99d64fadca9fa8 (diff) | |
download | erlang-52c36fa7a6a6cb81f0c068892de5b1553015e57c.tar.gz |
Make sure to keep tail in strings containing emojis as well
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stdlib/test/string_SUITE.erl | 6 | ||||
-rw-r--r-- | lib/stdlib/uc_spec/gen_unicode_mod.escript | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/stdlib/test/string_SUITE.erl b/lib/stdlib/test/string_SUITE.erl index 2539bf8692..7d5330ddb8 100644 --- a/lib/stdlib/test/string_SUITE.erl +++ b/lib/stdlib/test/string_SUITE.erl @@ -652,6 +652,9 @@ cd_gc(_) -> [778|<<>>] = string:next_codepoint(tl(string:next_codepoint(<<$e,778/utf8>>))), [0|<<128,1>>] = string:next_codepoint(<<0,128,1>>), {error,<<128,1>>} = string:next_codepoint(<<128,1>>), + [128021|<<>>] = string:next_codepoint(<<128021/utf8>>), %% Dog + [128021|<<8205/utf8>>] = string:next_codepoint(<<128021/utf8,8205/utf8>>), %% Dog + ZWJ + [128021|<<8205/utf8,129466/utf8>>] = string:next_codepoint(<<128021/utf8,8205/utf8,129466/utf8>>), %% Dog + ZWJ + Service vest == Service dog [] = string:next_grapheme(""), [] = string:next_grapheme(<<>>), @@ -664,6 +667,9 @@ cd_gc(_) -> [[$e,778]|<<>>] = string:next_grapheme(<<$e,778/utf8>>), [0|<<128,1>>] = string:next_grapheme(<<0,128,1>>), {error,<<128,1>>} = string:next_grapheme(<<128,1>>), + [128021|<<>>] = string:next_grapheme(<<128021/utf8>>), %% Dog + [[128021,8205]|<<>>] = string:next_grapheme(<<128021/utf8,8205/utf8>>), %% Dog + ZWJ + [[128021,8205,129466]|<<>>] = string:next_grapheme(<<128021/utf8,8205/utf8,129466/utf8>>), %% Dog + ZWJ + Service vest == Service dog ok. diff --git a/lib/stdlib/uc_spec/gen_unicode_mod.escript b/lib/stdlib/uc_spec/gen_unicode_mod.escript index af27e47337..1a5049534a 100644 --- a/lib/stdlib/uc_spec/gen_unicode_mod.escript +++ b/lib/stdlib/uc_spec/gen_unicode_mod.escript @@ -705,10 +705,10 @@ gen_gc(Fd, GBP) -> " _ -> [lists:reverse(Acc)|T0]\n" " end\n" " end;\n" - "gc_ext_pict([], _T0, Acc) ->\n" + "gc_ext_pict([], T0, Acc) ->\n" " case Acc of\n" - " [A] -> [A];\n" - " _ -> [lists:reverse(Acc)]\n" + " [A] -> [A|T0];\n" + " _ -> [lists:reverse(Acc)|T0]\n" " end;\n" "gc_ext_pict({error,R}, T, Acc) ->\n" " gc_ext_pict([], T, Acc) ++ [R].\n\n"), @@ -722,10 +722,10 @@ gen_gc(Fd, GBP) -> " _ -> [lists:reverse(Acc)|T0]\n" " end\n" " end;\n" - "gc_ext_pict_zwj([], _, Acc) ->\n" + "gc_ext_pict_zwj([], T0, Acc) ->\n" " case Acc of\n" - " [A] -> [A];\n" - " _ -> [lists:reverse(Acc)]\n" + " [A] -> [A|T0];\n" + " _ -> [lists:reverse(Acc)|T0]\n" " end;\n" "gc_ext_pict_zwj({error,R}, T, Acc) ->\n" " gc_ext_pict_zwj([], T, Acc) ++ [R].\n\n"), |