D 2017-05-03T08:57:13.765 J assignee nobody J closer nobody J cmimetype text/html J comment The\sdocumentation\sof\sTcl_UniCharToUtf()\ssays:\r\n\r\n\r\nTcl_UniCharToUtf\sstores\sthe\sTcl_UniChar\sch\sas\sa\sUTF-8\sstring\sin\sstarting\sat\sbuf.\sThe\sreturn\svalue\sis\sthe\snumber\sof\sbytes\sstored\sin\sbuf.\r\n\r\n\r\n

\r\nBut\sTcl_UniCharToUtf(0,buf)\sstores\s"\\300\\200"\sinto\sbuf,\sthis\sis\snot\san\sUTF-8\sstring,\sit's\san\sanomaly\s(belongs\sto\sMUTF-8),\snot\sconform\sto\sUTF-8\sstandard.\sEither\sTcl_UniCharToUtf\sis\serroneous,\sor\sthe\sdocumentation\sis\sincomplete.\r\n\r\n

\r\nThis\sis\sa\ssevere\sproblem.\sIf\sanybody\sis\susing\sthis\sfunction\sto\sstore\san\sUTF-8\sstring\sin\sa\sdatabase,\strusting\sthe\sdocumentation,\sit\smight\shappen\sthat\sthe\sdatabase\sbecome\sdamaged,\sbecause\sin\sgeneral\sno\sother\s(properly\simplemented)\sUTF-8\sbased\stool\sis\sinterpreting\sthe\sanomaly\s"\\300\\200".\sPlease\snote\sthat\sUTF-8\sis\snot\sMUTF-8.\r\n\r\n

\r\nBTW:\sThe\sformats\sMUTF-8,\sWTF-8,\sand\sCESU-8\sare\snot\sreally\sencoding\sformats.\sThey\sare\smore\sor\sless\sinvented\sfor\sdesignating\sresults\sof\serroneous\sUTF-8\simplementations,\sespecially\sthe\sthing\swith\ssurrogates,\sa\sresult\sof\san\saccident\s(programming\serror).\sIt's\sembarrassing\sif\scorporates\slike\sMicrosoft,\sSun,\set\sal,\sare\sdeclaring\sthese\sill-formed\sUTF-8\sencodings\sas\s"UTF-8".\sFree\ssoftware\sshould\snot\sfollow\sthe\sway\sof\scorporates.\sHere\sit\smeans:\sif\sthe\sresult\sof\sUnicode\spoint\szero\sis\snot\sUTF-8\s(RFC3629),\sthen\sthis\sshould\sbe\sexplicitly\sdocumented. J foundin 8.6/8.7 J is_private 0 J login gcramer J priority 5\sMedium J private_contact 9b7155594aadef44d10a978838b8fe108cdafdd1 J resolution None J severity Severe J status Open J submitter gcramer J subsystem 44.\sUTF-8\sStrings J title Tcl_UniCharToUtf()\snot\sconform\sto\sdocumentation J type Bug K af0f23b62fcb3e5d828c78e8b02f19114cfa9d48 U gcramer Z 51e7b836d8a1da261eb0bba5bee6e773