Skip to content
Tcl Source Code Artifact [bacc7bc697]
Login

Artifact [bacc7bc697]

Artifact bacc7bc69796d4c3d28a0b1a0c2e5da23e748db1:

Ticket change [bacc7bc697] - New ticket [418645ffffffffff|418645ffff] <i>Initial encoding selected incorrectly</i>. by mkuhn on 2001-04-24 20:28:54.
D 2001-04-24T20:28:54
J assignee nobody
J cmimetype text/plain
J comment The\sfunction\sunix/tclUnixInit.c:TclpSetInitialEncodings\ncontains\san\sugly\shack\sto\sguess\sfrom\sthe\slocale\sname\sthe\nmultibyte\sencoding\scurrently\sused\son\sa\sUnix\ssystem.\nThis\smight\swork\sin\ssome\sof\sthe\sfew\sspecial\scases\slisted\nin\sthe\sprovided\stable,\sbut\sit\sfails\sbadly\sin\sgeneral.\nFor\sexample\sunder\sLinux\s(glibc\s2.2),\sthe\slocale\sde_DE\nuses\sISO\s8859-1,\sthe\slocale\sde_DE@euro\suses\sISO\n8859-15,\sand\sthe\slocale\svi_VN\suses\sUTF-8.\sNone\sof\sthese\nis\scovered\sby\syour\stable.\n\nJust\sextending\slocaleTable[]\sis\snot\sthe\ssolution\shere,\nbecause\smanufacturers\schange\sthe\sencodings\sof\slocales\nsometimes.\sUnix\shas\san\sX/Open\sstandardized\sAPI\sfunction\nto\sdetermine\sthe\scharacter\sset\sof\sthe\scurrent\slocale!\sI\nsuggest\sthat\syou\sdrop\sthe\sentire\senvironment\svariable\nparsing\sand\stable\smechanics\sin\sTclpSetInitialEncodings.\nInstead\ssimply\sfirst\scall\n\n\s\ssetlocale(LC_NUMERIC,\s"C");\n\nsuch\sthat\sthe\sC\slibrary\ssets\sthe\slocale,\sthen\scall\n\n\s\snl_langinfo(CODESET)\n\n(on\sall\splatforms\swhere\slanginfo.h\sis\savailable)\swhich\nwill\sreturn\sthe\sname\sof\sthe\snow\sused\sencoding.\sThis\nwill\sbe\sa\sstring\ssuch\sas\n\n\s\sISO-8859-1\n\s\sISO-8859-15\n\s\sUTF-8\n\s\sEUC-JP\n\s\sKOI8-R\n\s\sSJIS\n\nThe\scommand\s"locale\s-m"\swill\sprint\syou\son\sa\ssystem\sa\nlist\sof\sall\savailable\sencodings.\sThese\sstrings\sare\nunfortunately\snot\sstrictly\sstandardized\sand\syou\swill\nstill\sneed\sa\stable\sto\smap\sthese\sencoding\snames\sinto\nthose\sused\sby\sTCL,\sbut\sthe\sreturn\svalue\sof\nnl_langinfo(CODESET)\sis\sa\sfar\sbetter\sstarting\spoint\sto\nfind\sthe\scurrently\sused\sencoding\sthan\sthe\slocale\sname.\n\nOn\ssome\ssystems\s(including\sall\swith\sglibc\s2.2\sfor\ninstance)\syou\sdo\snot\seven\shave\sto\sdetermine\sthe\nencoding\sfrom\sthe\soutput\sof\snl_langinfo(CODESET).\sThe\niconv\sfunction\swill\sprovide\syou\sa\scomprehensive\nconversion\sservice\sto\sconvert\swhatever\sencoding\nnl_langinfo(CODESET)\sidentified\sinto\s"UTF-8".\n\nThe\smatter\sis\sof\ssome\surgency,\sbecause\sSuSE\sLinux\sis\ngoing\sto\sswitch\sthe\sdefault\slocales\sof\smost\sEuropean\nUnion\scountries\sto\sISO\s8859-15\s(for\ssupport\sof\sthe\sEuro\nsymbol)\ssoon,\sand\sthen\syou\sassumption\sthat\sISO\s8859-1\nis\sa\sgood\sdefault\swill\sfail\sfor\smillions\sof\sLinux\nusers.\n\nX/Open\sspec\sfor\snl_langinfo:\n\nhttp://www.opengroup.org/onlinepubs/7908799/xsh/langinfo.h.html\n
J foundin obsolete:\s8.3.3
J priority 5\sMedium
J resolution None
J status Open
J submitter mkuhn
J subsystem 08.\sEnvironment\sVariables
J title Initial\sencoding\sselected\sincorrectly
J type Bug
K 418645ffffffffffffffffffffffffffffffffff
U mkuhn
Z cb6ea95657e54cbbf3a6596a297cd9d5