Version 2 of register new encodings at runtime

Updated 2003-11-17 14:01:04

I recently needed to use a few (slightly) non-standard encodings in a tclkit and wondered how I can register them at runtime. The solution that I eventually found was to copy the *.enc file into the encoding subdir of $tcl_library, like this:

 file copy shiftjis.enc [file join $tcl_library encoding]

For tclkits the $tcl_library directory is a virtual one, so it's probably ok to mess around with it. Are there any solutions for plain tcl shells?

At first, the encoding man page led me to believe it would be enough to just append my-encodings-dir to the tcl_libPath variable but that doesn't work...

Couldn't one have an encoding subcommand for this task, maybe something like "encoding create <name> <channel>" ?