I don't have koi8 on my tclsh, but I do have koi8-r, which I'm assuming is similar:
Code: Select all
set a [encoding convertfrom koi8-r $koi8text]
set b [encoding convertto cp1251 $a]
Be aware, though, that your $koi8text variable has to actually be in koi8 format. If you read it in with the 'source' command, it will be iso8859-1, always. Read the man page for "encoding" at tcl.activestate.com or dev.scriptics.com.