View Ticket
Ticket Hash: 570aa112299e92f023ec03ae226e4cbd797c55b8
Title: Kit: boot.tcl uses encoding "identity" instead "iso8859-1" since 8.6.0, kitInit.c TCL_GLOBAL scope missing
Status: Open Type: Code Defect
Severity: Minor Priority:
Subsystem: Resolution:
Last Modified: 2020-05-11 16:57:42
Version Found In: trunk
Description:
Dear Roy,

thank you for great KitCreator. This is another ticket in the series of this Wiki page:

In folder:
kitCreator/kitsh/buildsrc/kitsh0.0

File kitInit.c, Line 392:

<verbatim>
Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0);
</verbatim>

For me, the last parameter should be changed from "0" to "TCL_GLOBAL_ONLY" to make the variable "tclkit_system_encoding" visible for boot.tcl.

File boot.tcl, Line 103:

"encoding system" is checked for result "identity" as a sign, that the system encoding is not set.
Since tcl 8.6.0, the default is "iso8859-1" and not "identity".

Thus, I propose to change the code (perhaps only for tcl 8.6.x) to:

<verbatim>

if {[info exists ::tclkit_system_encoding] && $::tclkit_system_encoding != "" && [encoding system] ne $::tclkit_system_encoding } {
    catch {
        encoding system $::tclkit_system_encoding
    }
}

</verbatim>

This works for me to change the system encoding to "cp1252" using a C-VFS within a DLL.

Another change may be done to the lines just after this block:

<verbatim>

# If we've still not been able to set the encoding, revert to Tclkit defaults
if {[encoding system] eq "identity"} {
    catch {
        switch $::tcl_platform(platform) {
            windows        { encoding system cp1252 }
            macintosh    { encoding system macRoman }
            default        { encoding system iso8859-1 }
        }
    }
}

</verbatim>

I suppose, the platform "macintosh" has changed to "darwin". As utf-8 is now the default for mac and many Unix (which is an always present internal encoding), this block may perhaps be removed entirely.

What do you think ?

Thank you for all,
Harald