<i>Tcl interprets two adjacent surrogate code points as a character encoded using UTF-16</i> status still Closed with 5 other changes
by
.
D 2021-03-10T21:40:48.423
J closedate 2459284.40333823
J closer pooryorick
J icomment TIP\s597\sis\smore\slike\sit!\s\sConsidering\sa\sUnicode\sstring\sto\sbe\sa\ssequence\sof\scode\r\npoints\srather\sthan\sa\ssequence\sof\scharacters,\sand\sallowing\sa\sstring\sto\sbe\r\ncomposed\sof\sany\ssequence\sof\scode\spoints\sat\sall\sis\sthe\sperfect\ssolution\sto\sthis\r\nissue.\s\sTcl\scan\sleave\sit\sto\sthe\svarious\stranscoders\sto\sdecide\swhich\scode\spoint\r\nsequences\sare\sallowed\sin\sthe\starget\sencoding.\s\sBut\ssince\sany\ssequence\sof\r\nUnicode\scode\spoints\sis\sin\sfact\sUnicode,\s<code>string\sis\sUnicode</code>\sis\sa\r\nmisnomer.\s\s<code>string\sis\scharacter</code>\swould\sbe\sa\smore\saccurate\sname.\r\nPerhaps\sthere\scould\salso\sbe\sa\s<code>string\sis\sassigned</code>\sand\seven\sa\r\n<code>string\sis\ssurrogate</code>.\r\n\r\nIn\smy\sopinion,\srather\sthan\ssilently\sreplacing\scode\spoints\sit\scan't\swork\r\nwith,\san\sencoder\sshould\sproduce\san\serror\sif\sit\sis\shanded\sa\sstring\sit\scan't\r\nproperly\sencode.\s\sThe\scurrent\spractice\sof\sreplacing\sinvalid\scharacters\shas\r\ncaused\sall\ssorts\sof\strouble,\sand\sthe\ssooner\sit\sis\seliminated,\sthe\sbetter.\r\nReplacement\scan\sbe\simplented\sat\sthe\sscript\slevel\sif\sneeded,\sbut\sif\sit's\r\nbaked\sin,\sthere's\sno\sescaping\sit.\r\n\r\nThanks,\sJan,\sfor\sthe\srevisiting\sthe\sdesign\sand\sfinding\sa\sbetter\sapproach,\sand\r\nthanks,\sDon,\sfor\staking\stime\sto\sarticulate\sthe\salternatives.
J login pooryorick
J mimetype text/x-fossil-wiki
K 0d61d3a2bb905178694d6cde8147039974600274
U pooryorick
Z f1961396ab10c801648407c8112d63ae