.
D 2003-07-11T21:43:11
J assignee nijtmans
J cmimetype text/plain
J comment \nDocs\sfor\sTcl_UtfPrev(src,\sstart)\ssay:\n\n\s\s\s\s\sGiven\ssrc,\sa\spointer\sto\ssome\slocation\s\sin\s\sa\s\nUTF-8\s\sstring,\n\s\s\s\s\sTcl_UtfPrev\s\sreturns\sa\spointer\sto\sthe\sprevious\nUTF-8\scharac-\n\s\s\s\s\ster\sin\sthe\sstring.\s\sThis\sfunction\swill\s\snot\s\sback\n\sup\s\sto\s\sa\n\s\s\s\s\sposition\s\sbefore\s\sstart,\s\sthe\sstart\sof\sthe\sUTF-8\nstring.\s\sIf\n\s\s\s\s\ssrc\swas\salready\sat\sstart,\sthe\sreturn\svalue\swill\sbe\nstart.\n\nThe\ssource\scode\scomments\sjust\sbefore\sTcl_UtfPrev\nalso\ssay:\n\n\s*\s\s\s\s\s\sGiven\sa\spointer\sto\ssome\scurrent\slocation\sin\sa\nUTF-8\sstring,\n\s*\s\s\s\s\s\smove\sbackwards\sone\scharacter.\s\sThis\sworks\ncorrectly\swhen\sthe\n\s*\s\s\s\s\s\spointer\sis\sin\sthe\smiddle\sof\sa\sUTF-8\scharacter.\n\nSo\sthe\sclaim\sis\sthat\sthe\ssrc\sargument\scan\sbe\sa\spointer\nto\sa\strailing\sbyte\sof\sa\smulti-byte\scharacter.\n\nHowever,\sthat\sdoes\snot\sappear\sto\sbe\swhat\sthe\nroutine\sreally\sdoes.\s\sInstead,\sthe\sroutine\sstarts\na\ssearch\sat\sone\sbyte\sbefore\sthe\ssrc\sargument,\sand\nsearches\sbackward\sfor\sthe\sbeginning\sof\sa\sUTF8\ncharacter\sbyte-sequence\sand\sreturns\sthat.\n\nSo,\sfor\sexample,\s\n\n\s\s\s\sCONST\schar\s*word="ab\\303\\521";\n\s\s\s\sTcl_UtfPrev(word+3,word);\n\nwill\sreturn\sword+2\s(pointer\sto\sthe\sé\scharacter\sin\sUTF8)\nand\snot\sword+1\s(pointer\sto\sthe\s'b')\sas\sI\swould\sexpect.\n\nOne\sfeature\sof\sthe\scurrent\sTcl_UtfPrev()\nimplementation\sis\sthat\sit\sis\scurrently\ssafe\nto\spass\sin\sa\s'src'\sargument,\sthat\spoints\sone\nbyte\spast\sthe\send\sof\sthe\sallocated\sbuffer,\nwhich\scan\sbe\suseful,\seven\sthough\sit\sseems\ncounter\sto\sthe\sdocumentation.\n\nEither\simplementation\sor\sdocumentation\nought\sto\sbe\schanged\sto\sbring\sthem\sinto\nagreement.\n\n
J foundin obsolete:\s8.4.3
J priority 5\sMedium
J resolution None
J status Open
J submitter dgp
J subsystem 44.\sUTF-8\sStrings
J title Tcl_UtfPrev\snot\sas\sdocumented\s?
J type Bug
K 769895ffffffffffffffffffffffffffffffffff
U dgp
Z f23287f6127152639b8c1bc42bc5399e