Skip to content
Tcl Source Code Artifact [09ce9b3441]
Login

Artifact [09ce9b3441]

Artifact 09ce9b344128ea106b91ec88043e8d660bd2e687:

Ticket change [09ce9b3441] - New ticket [218406ffffffffff|218406ffff] <i>unicode BOM not removed</i>. by nobody on 2000-10-26 00:57:11.
D 2000-10-26T00:57:11
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s5336\sBug\nVersion:\s8.3.1\nSubmitDate:\s'2000-05-03'\nLastModified:\s'2000-08-15'\nSeverity:\sMED\nStatus:\sClosed\nSubmitter:\sangie\nChangedBy:\sericm\nOS:\sWindows\s98\nMachine:\spentium\sII\nFixedDate:\s'2000-10-25'\nClosedDate:\s'2000-08-15'\n\n\nTcl\s8.3.1\sBug\n\nName:\s\sdoug\sedmunds\nemail:\s\[email protected]\nSupport:\s\sNone\nSeverity:\s\s3\nOperatingSystem:\s\sWindows\s98\nMachine:\s\spentium\sII\nSynopsis:\s\sunicode\sBOM\snot\sremoved\n\nReproducibleScript:\nBOM\s=\sByte\sOrder\sMark\ssometimes\splaced\sat\sbeginning\sof\sutf-16\sfiles\neither\sFEFF\sor\sFFFE,\ssignifying\slittle-endian\sor\sbig-endian\sformat.\n\n\n1.\s"encoding\sconvertfrom\sunicode"\n#fn\sis\sa\sunicode\sutf-16\sfile\nproc\sread_unifile\s{fn}\s{\n\sset\sf\s[open\s$fn\sr]\n\sset\stext\s[encoding\sconvertfrom\sunicode\s[read\s$f\s]]\n\sclose\s$f\n\sreturn\s$text\n\s}\ncall\sproc:\s\s\nset\sresult\s[read_unifile\sunifile.txt]\s\nset\s$result\s\s<<BOM\snot\sremoved\n\n2.\s\sfconfigure\s$file\s-encoding\sunicode\n\n\s\sproc\sfile:uread\s{fn}\s{\n\s\s\s\sset\sencoding\s""\n\s\s\s\sset\sf\s[open\s$fn\sr]\n\s\s\s\sif\s{[info\stclversion]>=8.1}\s{\n\s\s\s\s\s\s\s\sgets\s$f\sline\n\s\s\s\s\s\s\s\sif\s{[regexp\s\\xFE\\xFF\s$line]||[regexp\s\\xFF\\xFE\s$line]}\s{\n\s\s\s\s\s\s\s\s\s\s\s\sfconfigure\s$f\s-encoding\sunicode\n\s\s\s\s\s\s\s\s\s\s\s\sset\sencoding\sunicode\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\sseek\s$f\s0\sstart\s;#\srewind\s--\sreal\sreading\sis\sstill\sto\scome\n\s\s\s\s}\n\s\s\s\sset\stext\s[read\s$f\s[file\ssize\s$fn]]\n\s\s\s\sclose\s$f\n\s\s\s\sif\s{$encoding=="unicode"}\s{\nregsub\s-all\s"\\uFEFF|\\uFFFE"\s$text\s""\stext\n\s\s\s\s}\n\s\s\s\sreturn\s$text\n\s\s}\n\nset\sresult\s[file:uread\sunifile.txt]\s\nset\s$result\s\s<<BOM\swas\snot\sremoved\n\n\nObservedBehavior:\nBOM\smust\sbe\smanually\sremoved.\nIf\sthe\sunicode\sfile\sbeing\sread\sin\swill\sbe\sevaluated,\nit\swill\sfail\sas\sa\sscript,\sas\sin\neval\s$result\n\n\nDesiredBehavior:\nBOM,\sif\spresent,\sautomatically\sremoved\swhen\sfile\sis\sloaded\n\nPatch:\nassuming\sstring\sthat\sfile\sis\sstored\sinto\sis\snamed\s$text\n\nregsub\s-all\s"\\uFEFF|\\uFFFE"\s$text\s""\stext\n\n\nMy\sreading\sof\sthe\sUTF\sBOM\sFAQ\sis\sthat\sTcl\sshould\s_not_\sautomatically\sremove\sthe\sBOM.\s\sThe\suse\sof\sa\sBOM\sis\sprotocol\sdependant,\sso\sinformation\sabout\sits\spresence\sor\sabsence\smay\sbe\srelevant\sto\sa\sdeveloper\susing\sTcl.\s\sIn\saddition,\sdepending\son\sthe\sprotocol,\sthe\sBOM\smay\sactually\sbe\sdata\s(specifically,\sa\szero-width\snon-breaking\sspace),\sso\sremoving\sit\scould\sbe\sincorrect.\n\nPlease\scorrect\sme\sif\sI\sam\swrong;\smy\sinformation\sis\sderived\sfrom\sthe\sUTF/BOM\sFAQ\sat:\n\nhttp://www.unicode.org/unicode/faq/utf_bom.html\n\n\s\s\sEric\sMelski\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sThe\sOther\sTcl\sGuy\n\s\s\sericm\sat\sajubasolutions.com\s\s\s\s\s\s\s\s\s\s\s\sAjuba\sSolutions\n\n--\s08/15/2000\sericm\n\n
J foundin obsolete:\s8.3.1
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 57.\szlib
J title unicode\sBOM\snot\sremoved
J type Bug
K 218406ffffffffffffffffffffffffffffffffff
U nobody
Z ca38756c8404da6b786d544d24d2daf0