<i>Tcl interface to stop on encoding errors</i> status still Open with 6 other changes
by
.
D 2021-03-25T23:03:36.565
J assignee jan.nijtmans
J closer nobody
J comment When\s[encoding\sconvertto]\sencounters\sa\scharacter\sthat\s\r\ncannot\sbe\srepresented\sin\sthe\starget\sencoding,\sit\s\r\nsilently\ssubstitutes\sa\sdefault\sinstead.\sIn\sthe\sC\s\r\ninterface\sthere\sis\sa\sflag\sTCL_ENCODING_STOPONERROR\swhich\s\r\ninstead\scauses\sthe\sunderlying\sfunction\sto\sreturn\swith\san\s\r\nerror\swhen\sthis\scondition\soccurs.\sIt\swould\sbe\suseful\sto\s\r\nhave\sa\sswitch\sfor\s[encoding\sconvertto]\sto\sget\sthe\ssame\s\r\nbehaviour\sthere,\sespecially\sfor\scross-platform\s\r\ninstallation\sprograms\s(where\sencoding\sconversions\sare\s\r\ncommon\sand\sunnoticed\scharacter\ssubstitutions\scan\sbe\svery\s\r\ndangerous).\r\n\r\nPS:\sWhile\sI'm\sat\s[encoding]\sanyway,\sI\smight\sas\swell\s\r\npoint\sout\sthat\sthe\sman\spage\sfor\sthe\s[encoding]\scommand\s\r\n(of\sTcl8.4\sas\scurrently\son\stcl.activestate.com)\sin\sthe\s\r\nExample\ssection\sincorrectly\sclaims\sthat\s"because\sthe\s\r\nsource\scommand\salways\sreads\sfiles\susing\sthe\sISO8859-1\s\r\nencoding,\sTcl\swill\streat\seach\sbyte\sin\sthe\sfile\sas\sa\s\r\nseparate\scharacter\sthat\smaps\sto\sthe\s00\spage\sin\sUnicode".\s\r\nI\sbelieve\sthe\struth\sis\srather\sthat\s[source]\suses\sthe\s\r\nsystem\sencoding.\sThe\sexample\sshould\swork,\ssince\s\\xHH\s\r\nproduces\scharacter\sin\ssaid\sUnicode\spage,\sbut\sincluding\s\r\nthe\scorresponding\sbytes\sas\sexplicit\scharacters\sin\sthe\s\r\nsource\sprobably\swon't\swork\scross-platform.
J login jan.nijtmans
J mimetype text/plain
J severity Minor
K 535705ffffffffffffffffffffffffffffffffff
U jan.nijtmans
Z e795d2fdbcc00e01b7f4c0efbc035d31