Skip to content
Tcl Source Code Artifact [5de20983ca]
Login

Artifact [5de20983ca]

Artifact 5de20983caacee788e8ca76e00b13f1436352876:

Ticket change [5de20983ca] - New ticket [1165752fffffffff|1165752fff] <i>New encodings: utf-16, utf-16be, utf-16le</i>. by andygoth on 2005-03-18 04:44:06.
D 2005-03-18T04:44:06
J assignee dkf
J cmimetype text/plain
J comment The\s"unicode"\sencoding\sprovides\ssomething\slike\nutf-16ne,\swhere\sne\sis\snative\sendianness.\s\sThis\sisn't\nvery\suseful,\sand\sit\srequires\sscripts\sto\sspecially\nprocess\sbyte\sarrays\s(swap\sbyte\sorder,\sstrip/add\sBOM)\npassing\sinto\s[encoding\sconvertfrom]\sand\sout\sof\n[encoding\sconvertto].\n\nWhat's\sneeded\sare\s"utf-16",\s"utf-16be",\sand\s"utf-16le"\nencodings.\s\sBy\sall\smeans,\skeep\s"unicode"\sas\sit\sis\sto\navoid\sbreaking\sstuff.\s\sBut\sthese\snew\sencodings\swill\nmore\sclosely\sadhere\swith\sthe\sstandards\sof\sthe\ssame\sname.\n\n"utf-16"\swill\scorrectly\shandle\san\sinitial\sBOM\n(byte-order\smark):\s\sIf\spresent,\sit\sis\sstripped\sbut\naffects\sthe\sbyte\sordering\sof\sthe\srest\sof\sthe\sstring.\s\nIf\sabsent,\sbig-endian\sorder\sis\sassumed.\s\sIf\sfound\sin\nthe\smiddle\sof\sthe\sstring,\sit\sis\staken\sas\sZWNBSP\n(zero-width\snon-breaking\sspace).\s\sAnd\swhen\stranslating\nto\s"utf-16",\san\sinitial\sBOM\sis\sprepended.\n\n"utf-16le"\sand\s"utf-16be"\swill\sassume\slittle-endian\sand\nbig-endian\sbyte\sorderings,\srespectively,\sand\swill\streat\nBOMs\sas\sZWNBSPs.\n\n(Or\sperhaps\sI\shave\smisread\sthe\sstandard.)\n\nI\shave\sseen\scomments\sto\sthe\seffect\sthat\sthe\sBOM\sshould\nnever\sbe\sstripped\sbecause\sit\sconveys\sinformation\s(the\nbyte\sordering)\sthat\smay\sbe\suseful\sat\sthe\sscript\slevel.\n\sBut\swhy\swould\sthe\sprogrammer\swant\sto\sknow\sthe\sbyte\nordering\sof\sa\sutf-16\sstring?\s\sI\scan't\sthink\sof\sa\sgood\nreason.\s\sAll\sI\scan\scome\sup\swith\sis,\sknowing\sthe\sbyte\norder\sallows\sthe\sprogrammer\sto\sdecode\sthe\sutf-16\sstring\nin\smultiple\schunks,\sonly\sthe\sfirst\sof\swhich\scontains\nBOM.\s\sBut\sthis\sis\sinvalid\sbecause\sthe\sprogrammer\scan't\nlegally\sseek\sto\sa\srandom\sbyte\slocation\sand\smust\ntherefore\sdecode\severything\sas\sa\ssingle\sunit.\s\sSo\sI\nconclude\sthat\sthe\sBOM\sis\spart\sof\sthe\sencoding\sand\snot\nthe\spayload.
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter andygoth
J subsystem 16.\sCommands\sA-H
J title New\sencodings:\sutf-16,\sutf-16be,\sutf-16le
J type RFE
K 1165752fffffffffffffffffffffffffffffffff
U andygoth
Z 6306c4b96bef8aea66a3df1e9441335f