Overview
| Artifact ID: | d073c629cc3fef27a63cc2d82be93a0109be0428 |
|---|---|
| Ticket: | 1201171fffffffffffffffffffffffffffffffff
TclpSetInitialEncodings works only once on Unix |
| User & Date: | yaroslav1 on 2005-05-18 14:55:52 |
Changes
- icomment:
Logged In: YES user_id=1272045 Sorry, I misled you (and forgot to describe a problem). This is a part from original letter (not in tclkit forum, sorry again): ------------------------- Sergey Vlasov vsu at altlinux.ru Sat Apr 16 18:32:59 CEST 2005 Does anyone know how to make tclkit find and use the proper system encoding in a non-English locale? I have tried tclkit-linux-x86-8.4.9 with LANG=ru_RU.KOI8-R, and also the 8.4.9 Win32 version under Windows 98, and both have the same problem: even if I rebuild tclkit with all encoding files (as described at http://www.equi4.com/tkunicode.html), I still get: $ tclkit % encoding system iso8859-1 (the Win32 version gives cp1252, which is also bad - the real system encoding in that case is cp1251). When a Tk application is launched in such environment (I tried Notebook - http://notebook.wjduquette.com/), it has major problems: all keyboard input is assumed to be in the broken system encoding, therefore I get iso8859-1 accented letters instead of Cyrillic characters. Obviously, this makes starkits unusable. I tried the newer tclkit version (8.5.a2) on Linux (http://www.equi4.com/pub/tk/8.5a2/tclkit-linux-x86.gz), and with LANG-ru_RU.KOI8-R it does not start at all: $ tclkit-linux-x86-8.5a2 system encoding " zsh: abort tclkit-linux-x86-8.5a2 If I execute "encoding system koi8-r" (after either adding the appropriate encoding files to tclkit, or copying them as described in http://wiki.tcl.tk/10382), then it seems to work (I tried to insert this statement into notebook2.1.1.vfs/lib/app-notebook/notebook.tcl after copying of the encoding files, and such hacked Notebook can handle Cyrillic characters properly). But obviously hardcoding the encoding name is not acceptable - the encoding should be determined automatically, like the "real" Tcl does it. Looking at tclUnixInit.c:TclpSetInitialEncodings(), I see that Tcl tries several methods to detect the system encoding and uses the first encoding for which Tcl_SetSystemEncoding() succeeds. However, at this point the encoding files stored inside tclkit are not yet available (because vfs is not initialized), therefore all calls to Tcl_SetSystemEncoding() fail, and system encoding is left set to "identity". ------------------------------------------------- My additons to it: On windows, tclkit fails because of its problems in working with VFS. This is from my bug report to them: ---------------------------- On windows (and at all), there is a bug it boot.tcl in tclkit: vfs::filesystem unmount $noe Example in russian locale on Win98 (cp1251): noe: D:/TCLKIT/русский/TCLKIT-WIN32-NEWEST.EXE ::vfs::filesystem info: d:/tclkit/русский/tclkit-win32-newest.exe Case differs, so it says: "no such mount" and crashes (on Win98 only). Replaced with: vfs::filesystem unmount [::vfs::filesystem info] tclkit-win32-newest.exe with added encodings by tkunicode.html on the site works ok. ---------------------------- So, there is no bug in Tcl itself on Windows, but on Unix, when tclkit tries to set system encoding second time (with encodings loaded), this function just doesn't do it as I described before. So, system encoding just gets "fixed" by tclkit startup code from "identity" to iso8859-1, which is not correct.
- login: "yaroslav1"
- mimetype: "text/plain"
- username: "yaroslav1"