瀏覽代碼

Fix decoding of "\uDBFF\uDFFF" surrogate pair.

pull/150/merge
David Hull 6 年之前
committed by Paul J. Davis
父節點
當前提交
5c29452a1e
共有 2 個檔案被更改,包括 5 行新增1 行删除
  1. +1
    -1
      c_src/utf8.c
  2. +4
    -0
      test/jiffy_04_string_tests.erl

+ 1
- 1
c_src/utf8.c 查看文件

@ -207,7 +207,7 @@ unicode_to_utf8(int c, unsigned char* buf)
} else {
return -1;
}
} else if(c < 0x10FFFF) {
} else if(c <= 0x10FFFF) {
buf[0] = (unsigned char) 0xF0 + (c >> 18);
buf[1] = (unsigned char) 0x80 + ((c >> 12) & 0x3F);
buf[2] = (unsigned char) 0x80 + ((c >> 6) & 0x3F);

+ 4
- 0
test/jiffy_04_string_tests.erl 查看文件

@ -108,6 +108,10 @@ cases(uescaped) ->
{
<<"\"\\uD83D\\uDE0A\"">>,
<<240, 159, 152, 138>>
},
{
<<"\"\\uDBFF\\uDFFF\"">>,
<<244, 143, 191, 191>>
}
];

Loading…
取消
儲存