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
<div>Dear Roy,</div><div><br /></div><div>thank you for great KitCreator. This is another ticket in the series of this Wiki page:</div><div>[].</div><div><br /></div><div>In folder:<br /></div><div>kitCreator/kitsh/buildsrc/kitsh0.0</div><div><br /></div><div>File kitInit.c, Line 392:</div><div><br /></div><div>&lt;verbatim&gt;</div><div>Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&amp;encodingName), 0);<br /></div><div>&lt;/verbatim&gt;<br /></div><div><br /></div><div>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.</div><div><br /></div><div>File boot.tcl, Line 103:</div><div><br /></div><div>"encoding system" is checked for result "identity" as a sign, that the system encoding is not set.</div><div>Since tcl 8.6.0, the default is "iso8859-1" and not "identity".</div><div><br /></div><div>Thus, I propose to change the code (perhaps only for tcl 8.6.x) to:</div><div><br /></div><div>&lt;verbatim&gt;</div><div><br /></div><div>if {[info exists ::tclkit_system_encoding] &amp;&amp; $::tclkit_system_encoding != "" &amp;&amp; [encoding system] ne $::tclkit_system_encoding } {<br />&nbsp;&nbsp;&nbsp; catch {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; encoding system $::tclkit_system_encoding<br />&nbsp;&nbsp;&nbsp; }<br />}</div><div><br /></div><div>&lt;/verbatim&gt;<br /></div><div><br /></div><div>This works for me to change the system encoding to "cp1252" using a C-VFS within a DLL.</div><div><br /></div><div>Another change may be done to the lines just after this block:</div><div><br /></div><div>&lt;verbatim&gt;</div><div><br /></div><div># If we've still not been able to set the encoding, revert to Tclkit defaults<br />if {[encoding system] eq "identity"} {<br />&nbsp;&nbsp;&nbsp; catch {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; switch $::tcl_platform(platform) {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; windows&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { encoding system cp1252 }<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; macintosh&nbsp;&nbsp;&nbsp; { encoding system macRoman }<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { encoding system iso8859-1 }<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }<br />}</div><div><br /></div><div>&lt;/verbatim&gt;</div><div><br /></div><div>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.</div><div><br /></div><div>What do you think ?</div><div><br /></div><div>Thank you for all,</div><div>Harald<br /></div><div><br /></div><div><br /></div>