Skip to content
Tcl Source Code Artifact [e7423af46b]
Login

Artifact [e7423af46b]

Artifact e7423af46b7b00fc6c37ea8495d1419e38de55ab:

Ticket change [e7423af46b] - Ticket [578030ffffffffff|578030ffff] <i>Tcl_UniChar is only 16 bits</i> status still Open with 4 other changes by keithp on 2002-07-09 23:15:32.
D 2002-07-09T23:15:32
J icomment Logged\sIn:\sYES\s\nuser_id=50020\n\n(section\s2.2\sof\sUnicode\s3.0)\n\n"From\sthe\sfull\srange\sof\s65536\scode\svalues,\s63486\sare\navailable\sto\srepresent\scharacters\swith\s16-bit\scode\svalues\nand\s2048\scode\svalues\sare\savailable\sto\srepresent\sand\nadditional\s1048544\scharacters\sthrough\spaired\s16-bit\scode\nvalues.\s\sThese\spaired\scode\svalues,\sor\ssurrogates,\swill\sallow\nimplementations\saccess\sto\sadditional\scharacters\sin\sthe\nfuture.\s<em>None\sof\sthese\ssurrogate\spairs\shas\sbeen\sassigned\nin\sthis\sversion\sof\sthe\sstandard.</em>"\n\nIn\sversion\s3.1\sand\s3.2,\sthere\shave\sbeen\ssignificant\nadditions\sto\sthe\sUnicode\sstandard,\sincluding\smany\sthousands\nof\sglyphs\soutside\sof\swhat\sis\snow\scalled\sthe\s"basic\nmultiligual\splane"\s(BMP).\s\sSeveral\snew\sencodings\shave\sbeen\ndefined,\sthe\sbasic\s16-bit\sencoding\s(UCS2)\sno\slonger\sprovides\nthe\s1-value\s1-codepoint\smapping\swhich\sTcl\sassumes.\n\nThe\sencoding\sstandard\shasn't\schanged,\s3.0\sexplicitly\sallows\nfor\scodepoints\soutside\sthe\sBMP,\swhat's\schanged\sis\sthat\sthere\nare\snow\smany\sdefined\scodepoints\sin\sthis\sextended\srange.\n\nIf\sthe\sintent\sis\sto\shave\sTcl\ssupport\sUnicode,\sthen\sthere\sis\nno\squestion\sthat\sthese\sadditional\scodepoints\smust\sbe\nrepresentable,\sthe\sonly\squestion\sis\show\sto\sdo\sso.\s\sI\nrecommend\sabandoing\sthe\s16\sbit\sencoding\sas\suseless;\sit\ndoesn't\sprovide\sthe\s1-to-1\smapping\swhich\smakes\sconstant-time\nindexing\strivial,\sand\swith\ssurrogates,\sit\srequires\smore\nbytes\son\saverage\sto\srepresent\sthe\ssame\sdata\sthan\sUTF-8.\s\sYou\nmay\sstill\swant\sto\sprovide\sthe\sexisting\s16-bit\sAPIs\sfor\ssome\nlevel\sof\sbinary\scompatibility;\sthose\sAPIs\scan\suse\ssurrogates\nto\sensure\sall\sUnicode\scodepoints\sare\srepresentable.\s\sAPIs\ninvolving\sa\ssingle\scodepoint\sshould\stransition\sto\susing\sa\nnew\s32-bit\sdatatype.\n\nConstant-time\sindexing\scan\sbe\simplemented\susing\sindexes\sinto\nthe\sstring,\sone\strivial\sdesign\swould\shave\sa\s32-bit\sindex\sfor\neach\s256\scodepoints.\s\sThat\smeans\slocating\sa\scodepoint\sby\nindex\stakes\sa\stable\slookup\sto\sfind\sthe\soffset\s(constant\ntime)\sand\sa\ssearch\sthrough\sthat\sportion\sof\sthe\sdata\s(time\nbounded\sby\sa\sconstant).\\\n\nUTF-8\snow\sspecifies\sthat\sup\sto\s6\sbytes\smay\sbe\srequired\sto\nhold\sa\svalue.\s\sRaising\sonly\sthat\slimit\sprovides\sthe\sminimum\nrequired\sfunctionality\sto\suse\snon-BMP\sglyphs\sin\sTcl;\sI've\nimplemented\sa\smodern\sX\sbackend\sthat\scan\saccess\snon-BMP\nglyphs\sas\slong\sas\sthe\sstrings\sare\snever\srepresented\sas\narrays\sof\sTcl_UniChars\sinside\sthe\sinterpreter.\s\sThe\sonly\ndifficulty\sthere\swas\sthat\sthe\sinternal\sUTF8\sto\sUCS\sconverter\nis\sdefined\sto\sreturn\sa\sTcl_UniChar\sand\sso\sI\shad\sto\suse\sa\nseparate\scomplete\simplementation.\n
J login keithp
J mimetype text/plain
J username keithp
K 578030ffffffffffffffffffffffffffffffffff
U keithp
Z 12d43e455039f6005127962d007b874c