.
D 2017-05-23T15:57:53.142
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment I\swork\sunder\sWindows\s7,\suse\sActiveTcl\s8.6.4.1\sfor\srunning\sand\sNotepad++\sfor\swriting\sTclTk\sscripts.\sScript\sfiles\sby\sdefault\sare\sutf-8\sencoded\swithout\sBOM.\sA\ssimple\sprogram\s-\slocated\s(say)\sin\sutf8test.tcl\s-\sdemonstrates\sthe\sproblem.\r\n\r\nset\sfd\s[open\s<path_to_file>/utf8test.txt\s{RDWR\sCREAT\sTRUNC}]\r\nbinary\sscan\sáéíöőúüűÁÉÍÖŐÚÜŰ\sH*\sdu\r\nputs\s$fd\s$du\r\nclose\s$fd;\sexit\r\n\r\nThe\shexeditor\sview\sof\sthe\sscript\sfile\r\n\r\n00000000\s\s73\s65\s74\s20\s66\s64\s20\s5B\s6F\s70\s65\s6E\s20\s75\s74\s66\s\sset\sfd\s[open\sutf\r\n00000016\s\s38\s74\s65\s73\s74\s2E\s74\s78\s74\s20\s7B\s52\s44\s57\s52\s20\s\s8test.txt\s{RDWR\s\r\n00000032\s\s43\s52\s45\s41\s54\s20\s54\s52\s55\s4E\s43\s7D\s5D\s0D\s0A\s0D\s\sCREAT\sTRUNC}]...\r\n00000048\s\s0A\s62\s69\s6E\s61\s72\s79\s20\s73\s63\s61\s6E\s20\sC3\sA1\sC3\s\s.binary\sscan\sáÃ\r\n00000064\s\sA9\sC3\sAD\sC3\sB6\sC5\s91\sC3\sBA\sC3\sBC\sC5\sB1\sC3\s81\sC3\s\s©Ã.öőúüűÃ.Ã\r\n00000080\s\s89\sC3\s8D\sC3\s96\sC5\s90\sC3\s9A\sC3\s9C\sC5\sB0\s20\s48\s2A\s\s‰Ã.ÖÅ.ÚÜŰ\sH*\r\n00000096\s\s20\s64\s75\s0D\s0A\s70\s75\s74\s73\s20\s24\s66\s64\s20\s5C\s6E\s\s\sdu..puts\s$fd\s\\n\r\n00000112\s\s24\s64\s75\s0D\s0A\s0D\s0A\s63\s6C\s6F\s73\s65\s20\s24\s66\s64\s\s$du....close\s$fd\r\n00000128\s\s0D\s0A\s0D\s0A\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s....\r\n\r\nshows\sthat\sthe\sutf-8\srepresentation\sof\sthe\stest\sstring\sis\r\n\r\nC3A1C3A9C3ADC3B6C591C3BAC3BCC5B1C381C389C38DC396C590C39AC39CC5B0\r\n\r\nRunning\sthe\stest\sscript\sby\sdouble\sclicking\son\sutf8test.tcl\sin\sthe\sWindows\sExplorer\swindow,\showever,\sproduces\sthe\sthe\shexadecimal\sstring\r\n\r\nc3a1c3a9c3adc3b6c518c3bac3bcc5b1c381c330c38dc313c590c361c353c5b0\r\n\r\nViewing\sthe\stwo\sstring\sside\sby\sside\r\n\r\nC3A1C3A9C3ADC3B6\sC591\sC3BAC3BCC5B1C381\sC389\sC38D\sC396\sC590\sC39A\sC39C\sC5B0\r\nc3a1c3a9c3adc3b6\sc518\sc3bac3bcc5b1c381\sc330\sc38d\sc313\sc590\sc361\sc353\sc5b0\r\n\r\nreveals\sthe\sproblem\sthat\sI\shave\srun\sup\sagainst\swhile\sdeveloping\sa\smuch\smore\scomplex\sapplication\sinvolving\sstmp,\smime\s&\shttp.\r\n\r\nThere\sis\sanother\scatch\shere.\sRun\sthe\sscript\sthrough\sthe\swish\sconsole.\sEven\sif\syou\sadd\s'fconfigure\s$fd\s-encoding\sutf-8'\sthe\sresult\sis\r\n\r\n\s\s\s\s\s\s\s\s\s\s\s\sQ\s\s\s\s\s\s\s\sq\s\s\s\s\s\s\s\s\s\s\s\s\s\sP\s\s\s\s\s\s\s\sp\r\ne1\se9\sed\sf6\s51\sfa\sfc\s71\sc1\sc9\scd\sd6\s50\sda\sdc\s70\r\ná\s\sé\s\sí\s\sö\s\ső\s\sú\s\sü\s\sű\s\sÁ\s\sÉ\s\sÍ\s\sÖ\s\sŐ\s\sÚ\s\sÜ\s\sŰ\r\n\r\nYou\shave\sto\sapply\s'encoding\sconvertto\sutf-8'\sto\sthe\sstring\sthen\syou\sachieve\sthe\sdesired\sresult.\sThe\snew\sscript,\showever,\swon't\swork\sby\sclick-and-run.\r\n\r\nYou\smay\snow\sdraw\syour\sconclusions.\r\n\r\nThanks\sfor\sany\shelp
J foundin ActiveTcl\s8.6.4.1
J is_private 0
J login jgnemeth
J priority 5\sMedium
J private_contact b70ac307e27522f4d296a81696cf3ac44bc96fb6
J resolution None
J severity Important
J status Open
J submitter jgnemeth
J subsystem 44.\sUTF-8\sStrings
J title Errors\sin\sutf-8\sencoding
J type Bug
K cae6ee6af19d2893839f2861230ae33b2f1a802f
U jgnemeth
Z 2da4b82d3dbc9884509df79174ff8e82