Ken Takata wrote:
> Hi Bram,
>
> 2016/2/28 Sun 2:41:47 UTC+9 Bram Moolenaar wrote:
> > Patch 7.4.1434
> > Problem: JSON encoding doesn't hanel surrogate pair.
> > Solution: Improve multi-byte handling of JSON. (Yasuhiro Matsumoto)
> > Files: src/json.c, src/testdir/test_json.vim
>
> > ***************
> > *** 69,74 ****
> > --- 75,82 ----
> >
> > if has('multi_byte')
> > call assert_equal(s:jsonmb, json_encode(s:varmb))
> > + call assert_equal(s:varsp1, json_decode(s:jsonsp1))
> > + call assert_equal(s:varsp2, json_decode(s:jsonsp2))
> > endif
> >
> > call assert_equal(s:jsonnr, json_encode(s:varnr))
> > ***************
> > *** 105,110 ****
> > --- 113,120 ----
> >
> > if has('multi_byte')
> > call assert_equal(s:varmb, json_decode(s:jsonmb))
> > + call assert_equal(s:varsp1, js_decode(s:jsonsp1))
> > + call assert_equal(s:varsp2, js_decode(s:jsonsp2))
> > endif
> >
> > call assert_equal(s:varnr, json_decode(s:jsonnr))
>
> The tests are added in wrong functions.
> They should be:
>
> --- a/src/testdir/test_json.vim
> +++ b/src/testdir/test_json.vim
> @@ -82,8 +82,8 @@ func Test_json_encode()
>
> if has('multi_byte')
> call assert_equal(s:jsonmb, json_encode(s:varmb))
> - call assert_equal(s:varsp1, json_decode(s:jsonsp1))
> - call assert_equal(s:varsp2, json_decode(s:jsonsp2))
> + "call assert_equal(s:jsonsp1, json_encode(s:varsp1))
> + "call assert_equal(s:jsonsp2, json_encode(s:varsp2))
> endif
>
> call assert_equal(s:jsonnr, json_encode(s:varnr))
> @@ -120,8 +120,8 @@ func Test_json_decode()
>
> if has('multi_byte')
> call assert_equal(s:varmb, json_decode(s:jsonmb))
> - call assert_equal(s:varsp1, js_decode(s:jsonsp1))
> - call assert_equal(s:varsp2, js_decode(s:jsonsp2))
> + call assert_equal(s:varsp1, json_decode(s:jsonsp1))
> + call assert_equal(s:varsp2, json_decode(s:jsonsp2))
> endif
>
> call assert_equal(s:varnr, json_decode(s:jsonnr))
> @@ -185,6 +185,8 @@ func Test_js_encode()
>
> if has('multi_byte')
> call assert_equal(s:jsonmb, js_encode(s:varmb))
> + "call assert_equal(s:jsonsp1, js_encode(s:varsp1))
> + "call assert_equal(s:jsonsp2, js_encode(s:varsp2))
> endif
>
> call assert_equal(s:jsonnr, js_encode(s:varnr))
> @@ -223,6 +225,8 @@ func Test_js_decode()
>
> if has('multi_byte')
> call assert_equal(s:varmb, js_decode(s:jsonmb))
> + call assert_equal(s:varsp1, js_decode(s:jsonsp1))
> + call assert_equal(s:varsp2, js_decode(s:jsonsp2))
> endif
>
> call assert_equal(s:varnr, js_decode(s:jsonnr))
Thanks.
> I added js*_encode tests as comment lines, because js*_encode doesn't
> seem to support surrogate pairs.
Encoding just creates utf-8. I don't think there is a reason to write
surrogate pairs, is there?
--
An SQL statement walks into a bar. He approaches two tables
and says, "Mind if I join you?"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.