.
D 2014-02-24T09:49:39.997
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment So\sfar\sas\sI\sunderstood\s"encoding\sconvertfrom\s$enc\s$text"\sis\sthe\sright\scommand\sto\sconvert\sfrom\sa\sstring\swith\sknown\sencoding\sto\sunicode.\sThis\sworks\sfine,\sexcept\s$enc\sis\sutf-8.\sPlease\stry\sthe\sfollowing\sscript\s(I\shope\sthis\stracker\sis\snot\scorrupting\sthe\sGreek):\r\n\r\n----------------------------------------------------------------------\r\n#!/usr/bin/wish\r\n\r\n#\s1.\sensure\syou\shave\sthe\sright\sencoding\sto\sread\sthe\sstring\r\n#\s2.\swe\swant\sconversion\sutf-8\s->\sunicode\r\nencoding\ssystem\sutf-8\r\n\r\nset\ssrc\s"Η\sΣάμος\sείναι"\r\n\r\n#\sthe\sresult\sof\sthis\soperation\sis\sbroken!\r\nset\suni\s[encoding\sconvertfrom\sutf-8\s$src]\r\nset\sutf\s[encoding\sconvertto\sutf-8\s$uni]\r\n\r\n#\sthis\sworks\sfine,\sit's\sa\siso8859-7\sencoded\sstring\r\nset\sgrk\s[encoding\sconvertfrom\siso8859-7\s"Ç\sÓÜìïò\såßíáé"]\r\n\r\npack\s[label\s.l1\s-text\s$src]\r\npack\s[label\s.l2\s-text\s$uni]\r\npack\s[label\s.l3\s-text\s$utf]\r\npack\s[label\s.l4\s-text\s$grk]\r\n----------------------------------------------------------------------\r\n\r\nYou\swill\ssee\sthat\sthe\sconversion\sfrom\sutf-8\sis\sbroken.\sConverting\sback\sis\sstill\sbroken.\sConversion\sfrom\siso8859-7\sis\sfine.\r\n\r\nMy\sapplication\sis\sonly\sworking\sif\sI\sexclude\sutf-8\sexplicitly\s(my\ssystem\sencoding\sis\sutf-8):\r\n\r\nif\s{$encoding\seq\s"utf-8"}\s{\r\n\s\sset\sdst\s$src\s;#\sbecause\sconvertfrom\sdoesn't\swork\r\n}\selse\s{\r\n\s\sset\sdst\s[encoding\sconvertfrom\s$encoding\s$src]\r\n}\r\n\r\nBut\sI\sdon't\sthink\sthat\sthis\sis\sintended,\sthe\sgeneric\scommand\s"convertfrom"\sshould\swork\swith\sall\sencodings\sdue\sto\sthe\smanual.\r\n\r\nPS:\sIn\smy\stests\sI've\sfigured\sout\sthat\ssometimes\sthe\sconversion\sto\sutf-8\sgives\sresults\swith\soverlong\ssequences,\ssuch\sresults\sare\sinvalid\sdue\sto\sthe\sutf-8\sspecification.
J foundin Tcl\s8.6.0\s(pl10)
J is_private 0
J login anonymous
J priority 5\sMedium
J private_contact 9b7155594aadef44d10a978838b8fe108cdafdd1
J resolution None
J severity Critical
J status Open
J submitter anonymous
J subsystem 11.\sConversions\sFrom\sString
J title utf-8\sto\sunicode\sconversion\sgives\sbroken\sresults
J type Bug
K 950acd6df4cffdac6dfecd189864e86262c33ea5
U anonymous
Z 72ec7ec2776d064730337512d2c95d71