.
D 2023-04-14T09:33:18.266
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment In\sthe\sfollowing\sscript,\sthe\ssequence\s\\xc0\\x40\sis\sinvalid\sfor\sutf-8,\sand\r\n<code>read</code>\sproduces\san\serror.\s\sWhen\sthe\sprofile\sis\schanged\sto\s"replace",\r\n<code>read</code>\sshould\sthen\sproduce\s<code>AB...</code>,\sbut\sinstead\sit\sloses\r\n<code>AB</code>\sand\sproduces\scharacters\sstarting\sat\sthe\sinvalid\ssequence.\r\n\r\n<blockquote><code><verbatim>\r\nset\schan\s[file\stempfile]\r\nchan\sconfigure\s$chan\s-translation\sbinary\r\n#\sThis\sis\snot\svalid\sUTF-8\r\nputs\s$chan\shelloAB\\xc0\\x40CD\\nEFG\r\nflush\s$chan\r\nseek\s$chan\s0\r\n\r\nchan\sconfigure\s$chan\s-encoding\sutf-8\s-profile\sstrict\r\nset\sdata\s[read\s$chan\s5];\s#->\shello\r\nputs\s$data\r\ncatch\s{read\s$chan\s5}\sres\s;#->\serror\smessage\r\nputs\s$res\r\nchan\sconfigure\s$chan\s-profile\sreplace\r\nset\sdata\s[read\s$chan\s5]\s;#->\sdoes\snot\sstart\swith\s"AB"\r\nputs\s$data\r\n</verbatim></code></blockquote>
J is_private 0
J login pooryorick
J priority 5\sMedium
J private_contact 2b2275eab1118e1fab0016cf1c5702893c6af86c
J resolution None
J severity Important
J status Open
J submitter pooryorick
J subsystem -\sNew\sBuiltin\sCommands
J title [read]\sloses\sdata\sunder\sstrict\sencoding
J type Bug
K 382e6c509c7c0355f3e362ab16b8706339b98cd7
U pooryorick
Z 2076023eb3b602bc82faab374da98643