<i>comparing UTF-16 strings doesn't account for surrogates</i> status still Open with 3 other changes
by
.
D 2020-04-29T17:50:02.303
J icomment \r\nFirst\sattempt\sat\sa\sfix\scommitted.\sIt\sexposes\strouble\swith\sthe\sinterface.\r\n\r\nThe\sroutine\ssignature\sis\r\n\r\nTcl_UniCharNcasecmp(const\sTcl_UniChar\s*ucs,\sconst\sTcl_UniChar\s*uct,\sunsigned\slong\snumChars)\r\n\r\nThe\snumChars\sargument\sname\ssuggests\swe\sshould\scount\schars,\sbut\swe've\r\nbeen\scounting\sUCS-2\scode\sunits.\s\sAs\swe\senter\sa\sworld\swhere\sthose\sare\snot\r\nthe\ssame\sthing,\swe\shave\sto\sre-specify\swhat\sthe\sargument\sshould\sbe\staken\sto\smean.\r\n\r\nIf\scallers\sthink\sof\sthe\sargument\sas\sthe\snumber\sof\sUCS-2\scode\sunits,\sthe\slength\r\nof\ssub-array,\sthen\sthe\scalls\scan\sstay\sunchanged,\sbut\swhen\sthat\snumber\ssplits\r\na\scharacter,\swe'll\sget\snonsense\sresults,\sas\sseen\sin\sthis\sfirst\sattempt.\r\n\r\nWe\swant\sto\scompare\sthe\scharacter\s\\uFFFF\sagainst\sthe\scharacter\s\\uD800\\uDC00\r\nbut\sthe\s(numChars\s=\s1)\sargument\sprevents\sus\staking\sthe\slow\ssurrogate\sinto\saccount\r\nas\swe\smust\sdo\sto\sget\sthe\sright\sanswer.
J login dgp
J mimetype text/plain
K e617e8a71a00496e9ec682caa1b4e7b5b98c55a7
U dgp
Z 30718061cc19870c2d0208810ccf5b00