Skip to content
Tcl Source Code Artifact [5427b1eeb1]
Login

Artifact [5427b1eeb1]

Artifact 5427b1eeb1214a20537e1d9b377b586d1d05f57215bb05e9e0d284b200650e67:

Ticket change [5427b1eeb1] - New ticket [a173f9229fe2fec8|a173f9229f] <i>fcopy and encoding errors: no partial write, no transparency write</i>. by oehhar on 2023-11-06 09:08:05.
D 2023-11-06T09:08:05.844
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment I\sam\scurrently\swriting\sdocs\sfor\schannel\sencoding\serrors.\r\nI\sdon't\sunderstand,\swhat\shappens\swith\sfcopy.\r\nSo,\sallow\sme,\sto\spost\sthis\stest-report\sstyle\sbug\sreport.\r\n\r\nI\shave\smade\stests\swith\s\stip-653\sbranch\s(which\sis\svery\ssimilar\sto\score-8-branch,\s7\slines\sdiff)\swith\sfcopy\sand\sencoding\serrors.\r\n\r\nI\simagined\s3\scases:\r\n\r\n\s\s\s*\s\s\sRead\sencoding\serror\swith\sdifferent\sencodings\r\n\s\s\s*\s\s\sRead\sencoding\serror\swith\sidentical\sencodings\sand\stranslation\r\n\s\s\s*\s\s\sWrite\sencoding\serrors\swith\sdifferent\sencodings\r\n\r\nThe\stest\ssession\sis\sas\sfollows:\r\n\r\n<h2>\sTest\sfile\screation:</h2>\r\nIn\sUTF-8,\sthis\sis\sat\sposition\s0:\s"A",\sat\sposition\s1:\s195,\swhich\sannounces\sa\smulti-byte\ssequence,\sat\sposition\s2\sa\s65\s(ASCII\sB),\swhich\sdoes\snot\scontinue\sthe\smulti-byte\ssequence\sand\sthus\scauses\sa\sread\sencoding\serror\r\n\r\n<verbatim>\r\nset\sf\s[open\stest_A_195_B.txt\swb];\sputs\s-nonewline\s$f\sA\\xC3B;\sclose\s$f\r\n</verbatim>\r\n\r\n<H2>Read\sencoding\serror\swith\sdifferent\sencodings</H2>\r\n\r\n<verbatim>\r\n%\sset\sfr\s[open\stest_A_195_B.txt\sr]\r\nfile12af8f0\r\n%\sset\sfw\s[open\sout.txt\sw]\r\nfile12af430\r\n%\sfconfigure\s$fr\s-encoding\sutf-8\s-profile\sstrict\s-translation\slf\r\n%\sfconfigure\s$fw\s-encoding\sunicode\s-profile\sstrict\s-translation\slf\r\n%\scatch\s{fcopy\s$fr\s$fw}\se\sd\r\n1\r\n%\sset\sd\r\n-code\s1\s-level\s0\r\n-errorstack\s{INNER\s{invokeStk1\sfcopy\sfile12af8f0\sfile12af430}}\r\n-errorcode\s{POSIX\sEILSEQ\s{invalid\sor\sincomplete\smultibyte\sor\swide\scharacter}}\r\n-errorinfo\s{...}\s-errorline\s1\r\n%\stell\s$fr\r\n1\r\n%\sflush\s$fw\r\n%\stell\s$fw\r\n0\r\n%\sclose\s$fr\r\n%\sclose\s$fw\r\n</verbatim>\r\n\r\nSo,\sthe\sfile\spointer\sis\sadvanced\sby\s1\son\sthe\sread\sside.\r\nBut\sthe\scorrect\sfirst\sbyte\sis\snot\swritten\sto\sthe\sdestination\sfile.\r\n\r\nIMHO,\sthe\sdestination\sfile\sshould\scontain\s"A"\sand\sthe\sfile\spointer\sshould\sbe\sadvanced.\r\n\r\n<H2>Read\sencoding\serror\swith\ssame\sencodings</H2>\r\n\r\nWithin\sthis\stest,\sthe\sonly\sdifference\sto\sthe\supper\sis\sthe\sfconfigure\sof\sthe\swrite\sside:\r\n\r\n<verbatim>\r\n%\sfconfigure\s$fw\s-encoding\sutf-8\s-profile\sstrict\s-translation\slf\r\n</verbatim>\r\n\r\nThe\sresult\sis\sthe\ssame:\sencoding\serror\sthrown,\sread\sposition\sadvanced.\r\n\r\nIMHO,\sthe\sfcopy\spage\sstates,\sthat\swith\sthe\ssame\sparameters\s(encoding,\stranslation),\sdata\sis\sjust\scopyied\sand\sno\serror\sdetection\sis\sdone.\r\nThis\sis\snot\sthe\scase.\sThe\serror\sis\sdetected.\r\n\r\n<h2>Encdoing\serror\son\swrite</h2>\r\n\r\nA\sfile\sis\swritten,\swhich\shas\sa\sunicode\scharacter\s\\u2022\snot\spresent\sin\siso8859-1.\r\nThen,\sthis\sfile\sis\sread\swith\sutf-8\sencoding\sand\swritten\swith\siso-8859-1:\r\n\r\n<verbatim>\r\n%\sset\sf\s[open\stest_A_2022_B.txt\sw];\sfconfigure\s$f\s-encoding\sutf-8;\sputs\s-nonewline\s$f\sA\\u2022B;\sclose\s$f\r\n%\sset\sfr\s[open\stest_A_2022_B.txt\sr]\r\nfile12af870\r\n%\sset\sfw\s[open\sout.txt\sw]\r\nfile1277800\r\n%\sfconfigure\s$fr\s-encoding\sutf-8\s-profile\sstrict\s-translation\slf\r\n%\sfconfigure\s$fw\s-encoding\siso8859-1\s-profile\sstrict\s-translation\slf\r\n%\scatch\s{fcopy\s$fr\s$fw}\se\sd\r\n1\r\n%\sset\sd\r\n-code\s1\s-level\s0\r\n-errorstack\s{INNER\s{invokeStk1\sfcopy\sfile12af870\sfile1277800}}\r\n-errorcode\s{POSIX\sEILSEQ\s{invalid\sor\sincomplete\smultibyte\sor\swide\scharacter}}\s-errorinfo\s{...}\s-errorline\s1\r\n%\stell\s$fr\r\n5\r\n%\stell\s$fw\r\n1\r\n%\sclose\s$fr\r\n%\sclose\s$fw\r\n</verbatim>\r\n\r\nThe\sone\scorrect\sby\sis\swritten.\sIt\sis\sinteresting,\sthat\sthe\sread\sfile\sposition\sis\sat\s5,\swhile\sit\sshould\sbe\sat\s1.\r\n\r\nThank\syou\sall,\r\nHarald
J foundin 8.7
J is_private 0
J login oehhar
J priority 5\sMedium
J private_contact 0f366eb3e9e2fcab52b8ebacd197db9047186a5f
J resolution None
J severity Minor
J status Open
J submitter oehhar
J subsystem 24.\sChannel\sCommands
J title fcopy\sand\sencoding\serrors:\sno\spartial\swrite,\sno\stransparency\swrite
J type Bug
K a173f9229fe2fec80dc8d43a16c1d7366fb11945
U oehhar
Z 880e27ce89004dd2ac66367de011e433