f



"string map" Probleme in tcl 8.4 mit Umlauten?

Seit Jahren setze ich TCL als integrierte Skript-Sprache in einer
Softwarel=F6sung ein (Microsoft Windows, MFC-Anwendung). Vor kurzem bin
ich von TCL 8.3.5 auf TCL 8.4.14 umgestiegen. Mit dieser Version
bekommen wir aber Probleme, da sich das Verhalten des Kommandos
"string map" ge=E4ndert hat. Beispiel:

    set a "=E4=F6=FC"
    set x [string map {. ,} $a]

x enth=E4lt dann "=C3=A4=C3=B6=C3=BC". Der String wird dabei offensichtlich=
 in
Unicode umgewandelt, wo TCL 8.3 den String noch unver=E4ndert lie=DF. In
der Shell (tclsh84.exe) wird die Umsetzung aber noch genauso wie unter
TCL 8.3 vorgenommen, also unver=E4ndert gelassen.

Die Initialisierung in der MFC-Anwendung ist vergleichbar zu der der
TCL-Shell:

    Tcl_SetDefaultEncodingDir( ... );
    Tcl_FindExecutable( ... );

    interp =3D Tcl_CreateInterp();

Auch das Einf=FCgen der Zeile

    setlocale(LC_ALL, "C");

wie sie von der main() Funktion der TCL-Shell verwendet wird, l=F6st das
Problem nicht.

Es besteht zwar die M=F6glichkeit, die TCL-Skripte wie folgt anzupassen:

    set a "=E4=F6=FC"
    set x [encoding convertfrom identity [string map {. ,} $a]]

..=2E. aber erstens m=FCsste ich dann sehr sehr viele Skripte anpassen und
zweitens habe ich Sorge, dass auch andere String-Funktionen unbemerkt
solche Unicode-Umwandlungen vornehmen. Es w=E4re mir also wichtig, den
Interpreter dazu zu bringen, sich genauso zu verhalten, wie die TCL-
Shell.

0
2/23/2007 11:10:19 AM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

8 Replies
1428 Views

Similar Articles

[PageSpeed] 42

Innerhalb von Tcl sind seit 8.1 im Prinzip alle Strings in Unicode
(utf-8 oder ucs-16). Bein Ein- und Ausgabe wird von bzw. nach
[encoding system] gewandelt.

Eigener C-Code, der mit Tcl Daten kommuniziert, aber kein utf-8 haben
will, sollte die Funktionen

char* Tcl_ExternalToUtfDString(encoding, src, srcLen, dstPtr)
int Tcl_ExternalToUtf(interp, encoding, src, srcLen, flags, statePtr,
dst, dstLen, srcReadPtr, dstWrotePtr,dstCharsPtr)
char * Tcl_UtfToExternalDString(encoding, src, srcLen, dstPtr)
int Tcl_UtfToExternal(interp, encoding, src, srcLen, flags, statePtr,
dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr)

ben=FCtzen.
Der Hack mit [encoding convertfrom identity ...] geht zwar als
Notl=F6sung, sollte aber nur mit Vorsicht ben=FCtzt werden.



0
2/23/2007 11:18:21 AM
Hallo Andreas,

wie Du, so nutze ich tcl auch schon lange, schon seit tcl 7.6. Die
=C4nderungen im string Umfeld, die tcl Unicode tauglich machten habe ich
auf Skriptebene nie bemerkt. Lediglich an tcl-C(++) Schnittstellen
mu=DFte ich etwas =E4ndern und f=FCr diese explicite Konvertierung in das
System Encoding sorgen.

Dein Beispiel kann ich leider auf Skriptebene nicht nachvollziehen -
was aber auch meiner Erfahrung entspricht:

    % set a "=E4=F6=FC=C4=D6=DC"
    =E4=F6=FC=C4=D6=DC
    % set b [string map {. ,} $a]
    =E4=F6=FC=C4=D6=DC
    % info patchlevel
    8.4.13
    % parray tcl_platform
    tcl_platform(byteOrder) =3D littleEndian
    tcl_platform(machine)   =3D intel
    tcl_platform(os)        =3D Windows NT
    tcl_platform(osVersion) =3D 5.1
    tcl_platform(platform)  =3D windows
    tcl_platform(threaded)  =3D 1
    tcl_platform(user)      =3D lemburg
    tcl_platform(wordSize)  =3D 4

Es w=E4re ja auch noch sch=F6ner, wenn wirklich die Einf=FChrung von Unicode
in tcl alte Skripte nicht mehr laufen lassen w=FCrde.

-------------------------- snip -

Stop, Du schriebst von tcl 8.4.14?

Tja - ich hab's nochmal mit tclkitsh 8.5a4 ausprobiert:

    % set a "=E4=F6=FC=C4=D6=DC"
    =E4=F6=FC=C4=D6=DC
    % set b [string map {. ,} $a]
    =B4=A5=E4=B4=A5=F6=B4=A5=FC=B4=A5=C4=B4=A5=D6=B4=A5=DC

Irgendwie mu=DF ich wohl obiges zur=FCcknehmen!

Und ich mu=DF mir wohl Sorgen um unsere Anwendung machen, die
Benutzereingaben mit Umlauten zul=E4=DFt und nun Schrott herausbekommt?

So nun noch ein Test mit tclkit 8.5a4:

    % set a "=E4=F6=FC=C4=D6=DC"
    =E4=F6=FC=C4=D6=DC
    % set b [string map {. ,} $a]
    =E4=F6=FC=C4=D6=DC

Na wunderbar - in der "Wish" ist das also kein Problem?

Dann liegt es also wohl an der F=E4higkeit in der puren Shell die
Unicodes darzustellen, was das text widget der tclkit Konsole ohne
Probleme kann?

Egal - da ist noch Kl=E4rungsbedarf!

Beste Gr=FC=DFe,

Martin Lemburg
UGS - a Siemens Company - Transforming the Process of Innovation


On Feb 23, 12:10 pm, "Andreas" <andreas.prie...@intalus.de> wrote:
> Seit Jahren setze ich TCL als integrierte Skript-Sprache in einer
> Softwarel=F6sung ein (Microsoft Windows, MFC-Anwendung). Vor kurzem bin
> ich von TCL 8.3.5 auf TCL 8.4.14 umgestiegen. Mit dieser Version
> bekommen wir aber Probleme, da sich das Verhalten des Kommandos
> "string map" ge=E4ndert hat. Beispiel:
>
>     set a "=E4=F6=FC"
>     set x [string map {. ,} $a]
>
> x enth=E4lt dann "=C3=A4=C3=B6=C3=BC". Der String wird dabei offensichtli=
ch in
> Unicode umgewandelt, wo TCL 8.3 den String noch unver=E4ndert lie=DF. In
> der Shell (tclsh84.exe) wird die Umsetzung aber noch genauso wie unter
> TCL 8.3 vorgenommen, also unver=E4ndert gelassen.
>
> Die Initialisierung in der MFC-Anwendung ist vergleichbar zu der der
> TCL-Shell:
>
>     Tcl_SetDefaultEncodingDir( ... );
>     Tcl_FindExecutable( ... );
>
>     interp =3D Tcl_CreateInterp();
>
> Auch das Einf=FCgen der Zeile
>
>     setlocale(LC_ALL, "C");
>
> wie sie von der main() Funktion der TCL-Shell verwendet wird, l=F6st das
> Problem nicht.
>
> Es besteht zwar die M=F6glichkeit, die TCL-Skripte wie folgt anzupassen:
>
>     set a "=E4=F6=FC"
>     set x [encoding convertfrom identity [string map {. ,} $a]]
>
> ... aber erstens m=FCsste ich dann sehr sehr viele Skripte anpassen und
> zweitens habe ich Sorge, dass auch andere String-Funktionen unbemerkt
> solche Unicode-Umwandlungen vornehmen. Es w=E4re mir also wichtig, den
> Interpreter dazu zu bringen, sich genauso zu verhalten, wie die TCL-
> Shell.


0
2/23/2007 11:46:36 AM
Hello Andreas,

like you, I also use tcl since a long time, since tcl 7.6. All the
changes about unicode string handling never caused troubles on script
level. Only on the tcl-C(++) APIs I needed to convert to the system
encoding explicitely!

So I'm not able to follow your example - which don't make me wonder,
because that's matching my experiences:


    % set a "=E4=F6=FC=C4=D6=DC"
    =E4=F6=FC=C4=D6=DC
    % set b [string map {. ,} $a]
    =E4=F6=FC=C4=D6=DC
    % info patchlevel
    8.4.13
    % parray tcl_platform
    tcl_platform(byteOrder) =3D littleEndian
    tcl_platform(machine)   =3D intel
    tcl_platform(os)        =3D Windows NT
    tcl_platform(osVersion) =3D 5.1
    tcl_platform(platform)  =3D windows
    tcl_platform(threaded)  =3D 1
    tcl_platform(user)      =3D lemburg
    tcl_platform(wordSize)  =3D 4

If your problem would have reoccurred in my tcl shell, I really would
have wondered why, even because all old scripts would have to change.

-------------------------- snip -

Stop, you wrote about using tcl 8.4.14?

So - I tried again with tclkitsh 8.5a4:

    % set a "=E4=F6=FC=C4=D6=DC"
    =E4=F6=FC=C4=D6=DC
    % set b [string map {. ,} $a]
    =B4=A5=E4=B4=A5=F6=B4=A5=FC=B4=A5=C4=B4=A5=D6=B4=A5=DC

Oh - I have to excuse, there seem to be a problem!

And I feel like detecting upcoming sorrows about our application,
which processes a lot of user inputs (with Umlaute), which could be
scrambled now?!

So - again a test, but now in the tclkit 8.5a4:

    % set a "=E4=F6=FC=C4=D6=DC"
    =E4=F6=FC=C4=D6=DC
    % set b [string map {. ,} $a]
    =E4=F6=FC=C4=D6=DC

Wonderfull - there seem to be no problem in the "wish"?

So it seemed to be about the ability to display those Unicode
characters? The tcl shell is not able, but the text widget of the
tclkit console is?

So there is still something to solve?!

Best Regards,

Martin Lemburg
UGS - a Siemens Company - Transforming the Process of Innovation

On Feb 23, 12:10 pm, "Andreas" <andreas.prie...@intalus.de> wrote:
> Seit Jahren setze ich TCL als integrierte Skript-Sprache in einer
> Softwarel=F6sung ein (Microsoft Windows, MFC-Anwendung). Vor kurzem bin
> ich von TCL 8.3.5 auf TCL 8.4.14 umgestiegen. Mit dieser Version
> bekommen wir aber Probleme, da sich das Verhalten des Kommandos
> "string map" ge=E4ndert hat. Beispiel:
>
>     set a "=E4=F6=FC"
>     set x [string map {. ,} $a]
>
> x enth=E4lt dann "=C3=A4=C3=B6=C3=BC". Der String wird dabei offensichtli=
ch in
> Unicode umgewandelt, wo TCL 8.3 den String noch unver=E4ndert lie=DF. In
> der Shell (tclsh84.exe) wird die Umsetzung aber noch genauso wie unter
> TCL 8.3 vorgenommen, also unver=E4ndert gelassen.
>
> Die Initialisierung in der MFC-Anwendung ist vergleichbar zu der der
> TCL-Shell:
>
>     Tcl_SetDefaultEncodingDir( ... );
>     Tcl_FindExecutable( ... );
>
>     interp =3D Tcl_CreateInterp();
>
> Auch das Einf=FCgen der Zeile
>
>     setlocale(LC_ALL, "C");
>
> wie sie von der main() Funktion der TCL-Shell verwendet wird, l=F6st das
> Problem nicht.
>
> Es besteht zwar die M=F6glichkeit, die TCL-Skripte wie folgt anzupassen:
>
>     set a "=E4=F6=FC"
>     set x [encoding convertfrom identity [string map {. ,} $a]]
>
> ... aber erstens m=FCsste ich dann sehr sehr viele Skripte anpassen und
> zweitens habe ich Sorge, dass auch andere String-Funktionen unbemerkt
> solche Unicode-Umwandlungen vornehmen. Es w=E4re mir also wichtig, den
> Interpreter dazu zu bringen, sich genauso zu verhalten, wie die TCL-
> Shell.


0
2/23/2007 11:54:23 AM
Hello again,

I'll continue in English, ok?

I extended the example a bit and let it run on tcl 8.4.13, on tclkitsh
8=2E5a4, on tclkit 8.5a4:

    tcl shell 8.4.13:
        % set a "=E4=F6=FC=C4=D6=DC"
        =E4=F6=FC=C4=D6=DC
        % set b [string map {. ,} $a]
        =E4=F6=FC=C4=D6=DC
        % string length $b
        6
        % format %c [scan [string index $b 0] %c]
        =E4
        % scan [string index $b 0] %c
        228
        % set fid [open f:/umlautTest.txt w];
        file9cc228
        % puts $fid $b;
        % close $fid;
        % set fid [open f:/umlautTest.txt r];
        file9cc368
        % set c [read $fid];
        =E4=F6=FC=C4=D6=DC

        % close $fid

    tclkitsh 8.5a4:
        % set a "=E4=F6=FC=C4=D6=DC"
        =E4=F6=FC=C4=D6=DC
        % set b [string map {. ,} $a]
        =B4=A5=E4=B4=A5=F6=B4=A5=FC=B4=A5=C4=B4=A5=D6=B4=A5=DC
        % string length $b
        6
        % format %c [scan [string index $b 0] %c]
        =B4=A5=E4
        % scan [string index $b 0] %c
        65412
        % set fid [open f:/umlautTest.txt w];
        filea277a8
        % puts $fid $b;
        % close $fid;
        % set fid [open f:/umlautTest.txt r];
        file9e1b08
        % set c [read $fid];
        ??????

        % close $fid

    tclkit 8.5a4:
        (bin) 1 % set a "=E4=F6=FC=C4=D6=DC"
        =E4=F6=FC=C4=D6=DC
        (bin) 2 % set b [string map {. ,} $a]
        =E4=F6=FC=C4=D6=DC
        (bin) 3 % string length $b
        6
        (bin) 4 % format %c [scan [string index $b 0] %c]
        =E4
        (bin) 5 % scan [string index $b 0] %c
        228
        (bin) 6 % set fid [open f:/umlautTest.txt w];
        filee9b6b8
        (bin) 7 % puts $fid $b;
        (bin) 8 % close $fid;
        (bin) 9 % set fid [open f:/umlautTest.txt r];
        filee9b9e0
        (bin) 10 % set c [read $fid];
        =E4=F6=FC=C4=D6=DC

        (bin) 11 % close $fid

What's going on with the tclkitsh 8.5a4?
Why the written text file contains not the data, that should have been
in there "=E4=F6=FC=C4=D6=DC"?

Best regards,

Martin Lemburg
UGS - a Siemens Company - Transforming the Process of Innovation


On Feb 23, 12:54 pm, "MartinLemburg@UGS" <martin.lemburg....@gmx.net>
wrote:
> Hello Andreas,
>
> like you, I also use tcl since a long time, since tcl 7.6. All the
> changes about unicode string handling never caused troubles on script
> level. Only on the tcl-C(++) APIs I needed to convert to the system
> encoding explicitely!
>
> So I'm not able to follow your example - which don't make me wonder,
> because that's matching my experiences:
>
>     % set a "=E4=F6=FC=C4=D6=DC"
>     =E4=F6=FC=C4=D6=DC
>     % set b [string map {. ,} $a]
>     =E4=F6=FC=C4=D6=DC
>     % info patchlevel
>     8.4.13
>     % parray tcl_platform
>     tcl_platform(byteOrder) =3D littleEndian
>     tcl_platform(machine)   =3D intel
>     tcl_platform(os)        =3D Windows NT
>     tcl_platform(osVersion) =3D 5.1
>     tcl_platform(platform)  =3D windows
>     tcl_platform(threaded)  =3D 1
>     tcl_platform(user)      =3D lemburg
>     tcl_platform(wordSize)  =3D 4
>
> If your problem would have reoccurred in my tcl shell, I really would
> have wondered why, even because all old scripts would have to change.
>
> -------------------------- snip -
>
> Stop, you wrote about using tcl 8.4.14?
>
> So - I tried again with tclkitsh 8.5a4:
>
>     % set a "=E4=F6=FC=C4=D6=DC"
>     =E4=F6=FC=C4=D6=DC
>     % set b [string map {. ,} $a]
>     =B4=A5=E4=B4=A5=F6=B4=A5=FC=B4=A5=C4=B4=A5=D6=B4=A5=DC
>
> Oh - I have to excuse, there seem to be a problem!
>
> And I feel like detecting upcoming sorrows about our application,
> which processes a lot of user inputs (with Umlaute), which could be
> scrambled now?!
>
> So - again a test, but now in the tclkit 8.5a4:
>
>     % set a "=E4=F6=FC=C4=D6=DC"
>     =E4=F6=FC=C4=D6=DC
>     % set b [string map {. ,} $a]
>     =E4=F6=FC=C4=D6=DC
>
> Wonderfull - there seem to be no problem in the "wish"?
>
> So it seemed to be about the ability to display those Unicode
> characters? The tcl shell is not able, but the text widget of the
> tclkit console is?
>
> So there is still something to solve?!
>
> Best Regards,
>
> Martin Lemburg
> UGS - a Siemens Company - Transforming the Process of Innovation
>
> On Feb 23, 12:10 pm, "Andreas" <andreas.prie...@intalus.de> wrote:
>
> > Seit Jahren setze ich TCL als integrierte Skript-Sprache in einer
> > Softwarel=F6sung ein (Microsoft Windows, MFC-Anwendung). Vor kurzem bin
> > ich von TCL 8.3.5 auf TCL 8.4.14 umgestiegen. Mit dieser Version
> > bekommen wir aber Probleme, da sich das Verhalten des Kommandos
> > "string map" ge=E4ndert hat. Beispiel:
>
> >     set a "=E4=F6=FC"
> >     set x [string map {. ,} $a]
>
> > x enth=E4lt dann "=C3=A4=C3=B6=C3=BC". Der String wird dabei offensicht=
lich in
> > Unicode umgewandelt, wo TCL 8.3 den String noch unver=E4ndert lie=DF. In
> > der Shell (tclsh84.exe) wird die Umsetzung aber noch genauso wie unter
> > TCL 8.3 vorgenommen, also unver=E4ndert gelassen.
>
> > Die Initialisierung in der MFC-Anwendung ist vergleichbar zu der der
> > TCL-Shell:
>
> >     Tcl_SetDefaultEncodingDir( ... );
> >     Tcl_FindExecutable( ... );
>
> >     interp =3D Tcl_CreateInterp();
>
> > Auch das Einf=FCgen der Zeile
>
> >     setlocale(LC_ALL, "C");
>
> > wie sie von der main() Funktion der TCL-Shell verwendet wird, l=F6st das
> > Problem nicht.
>
> > Es besteht zwar die M=F6glichkeit, die TCL-Skripte wie folgt anzupassen:
>
> >     set a "=E4=F6=FC"
> >     set x [encoding convertfrom identity [string map {. ,} $a]]
>
> > ... aber erstens m=FCsste ich dann sehr sehr viele Skripte anpassen und
> > zweitens habe ich Sorge, dass auch andere String-Funktionen unbemerkt
> > solche Unicode-Umwandlungen vornehmen. Es w=E4re mir also wichtig, den
> > Interpreter dazu zu bringen, sich genauso zu verhalten, wie die TCL-
> > Shell.


0
2/23/2007 12:03:38 PM
MartinLemburg@UGS <martin.lemburg.ugs@gmx.net> wrote:
> What's going on with the tclkitsh 8.5a4?

Just as a sidenote:  This problem is *not* specific to windows!

I start a terminal (a non-utf8 one), and start tclkit-8.5a4:
  % set a "������"
  ������
  % set b [string map {. ,} $a]
  äöüÄÖÜ
so, it gets echoed wrongly.

  % exec hd << $a
  00000000: E4 F6 FC C4 D6 DC       -                         |      |
  00000006;
  % exec hd << $b
  00000000: E4 F6 FC C4 D6 DC       -                         |      |
  00000006;
passing it as input to an external command seems to re-sanitize it.

  % format %c [scan [string index $b 0] %c]
  ä
  but then, also:
  % format %c [scan [string index $a 0] %c]
  ä
  % set a
  ������
  % set b
  äöüÄÖÜ

This is on linux (debian sarge)  with LANG=de_AT@euro
If I try in an utf-8 terminal, I always see correct umlauts.

0
avl1 (2748)
2/23/2007 3:09:02 PM
I see no problem in tclkit8.5a4 on Win XP:

(bin) 16 % set a =C4=D6=DC
=C4=D6=DC
(bin) 17 % string map {. ,} $a
=C4=D6=DC
(bin) 18 % info pa
8=2E5a4


0
2/23/2007 3:20:56 PM
QW5kcmVhcyBMZWl0Z2ViIHdyb3RlOgo+IEp1c3QgYXMgYSBzaWRlbm90ZTogIFRoaXMgcHJvYmxl
bSBpcyAqbm90KiBzcGVjaWZpYyB0byB3aW5kb3dzIQo+Cj4gSSBzdGFydCBhIHRlcm1pbmFsIChh
IG5vbi11dGY4IG9uZSksIGFuZCBzdGFydCB0Y2xraXQtOC41YTQ6Cj4gICAlIHNldCBhICLDpMO2
w7zDhMOWw5wiCj4gICDDpMO2w7zDhMOWw5wKPiAgICUgc2V0IGIgW3N0cmluZyBtYXAgey4gLH0g
JGFdCj4gICDDg8Kkw4PCtsODwrzDg+KAnsOD4oCTw4PFkwo+IHNvLCBpdCBnZXRzIGVjaG9lZCB3
cm9uZ2x5LgoKTG9va3MgbGlrZSB0Y2xraXQgZG9lc24ndCBoYXZlIHRoZSByaWdodCBlbmNvZGlu
ZyBhbmQgaXMgZmFsbGluZyBiYWNrCm9uIHRoZSAnaWRlbnRpdHknIGVuY29kaW5nIChub3QgZ29v
ZCEpCgpEb25hbC4K

0
2/23/2007 3:21:32 PM
In the English version of this originally German thread I just posted
the encoding of ...

    ... tcl shell 8.4.13
    ... tclkitsh 8.5a4
    ... tclkit 8.5a4

All those three tcl interpreters use cp1252.

I don't have a "normal" tcl 8.5 shell or wish, so I can't try with
those, but others perhabs can?

Best regards,

Martin Lemburg
UGS - a Siemens Company - Transforming the Process of Innovation

On Feb 23, 4:21 pm, "Donal K. Fellows" <donal.k.fell...@man.ac.uk>
wrote:
> Andreas Leitgeb wrote:
> > Just as a sidenote:  This problem is *not* specific to windows!
>
> > I start a terminal (a non-utf8 one), and start tclkit-8.5a4:
> >   % set a "=C3=A4=C3=B6=C3=BC=C3=84=C3=96=C3=9C"
> >   =C3=A4=C3=B6=C3=BC=C3=84=C3=96=C3=9C
> >   % set b [string map {. ,} $a]
> >   =C3=83=C2=A4=C3=83=C2=B6=C3=83=C2=BC=C3=83=E2=80=9E=C3=83=E2=80=93=C3=
=83=C5=93
> > so, it gets echoed wrongly.
>
> Looks like tclkit doesn't have the right encoding and is falling back
> on the 'identity' encoding (not good!)
>
> Donal.


0
2/23/2007 4:02:23 PM
Reply:

Similar Artilces:

"::tcl::tm::UnknownHandler ::tclPkgUnknown msgcat 1.4" caused by replacing Tcl 8.4.1 with 8.5.7
In the blog http://planet.larrythecow.org/archives/2009-07-26.html "The Twouble with Tcl" Iain Buchanan shows that redefining OPEN proc leads to the errors similar to what I am getting - when I replaced Tcl 8.4.1 with Tcl 8.5.7. In my case I don't know the exact root cause though ... Any ideas how I should proceed with debugging this issue ? Thanks, Alex tclsh c:/Tornado/host/resource/hutils/tcl/makeSymTbl.tcl ppc tmp.o symTbl.c invalid command name "::tcl::tm::UnknownHandler" while executing "::tcl::tm::UnknownHandler ::tclPkgUnknown msg...

checkbuttons in tcl 8.4.12 and 8.5a4 with -offvalue == ""?
Hello, I just realized some differences between the checkbuttons visualisation in tcl 8.4 and 8.5. If the offvalue of a checkbutton is set to "" (empty string) and the checkbutton is not "checked", than ... - in tcl 8.4.12 the background is white - in tcl 8.5a4 the background is grey and the "check" is still visible That's a bug, isn't it? If the offvalue is " " (one blank), than every thing works. Best regards, Martin Lemburg UGS - Transforming the Process of Innovation MartinLemburg@UGS wrote: > Hello, > > I just realized some differences between the checkbuttons visualisation > in tcl 8.4 and 8.5. > > If the offvalue of a checkbutton is set to "" (empty string) and the > checkbutton is not "checked", than ... > - in tcl 8.4.12 the background is white > - in tcl 8.5a4 the background is grey and the "check" is still > visible > > That's a bug, isn't it? > It's a much sought-after new feature. Checkbuttons in tk 8.5 have the ability to have three states: on, off and "tristate". The default value for the third state is the empty string. It's documented in the 8.5 manual page; look for the -tristatevalue option: http://www.tcl.tk/man/tcl8.5/TkCmd/checkbutton.htm#M17 Hhm, ... ok I know now why, but I don't understand why this way of tristate value usage was chosen! If I have an offvalue "" ...

[ info exists varName ] returns "" on Tcl 8.4.4 ... we're losing our sanity here
Hello, We're using "Tcl 8.4.4.0 Solaris/SPARC" .... pretty darned old version, I know ... but we have no choice as our program doesn't work well with newer versions. Anyway, we keep getting an error that we all used to think was simply impossible ... namely [ info exists ] not returning zero or non-zero but simply returning an empty string: can't use empty string as operand of "!" while executing "if { ! [ info exists ::varName ] } { return }" (procedure "debugOut" line 3) invoked from within "debugOut -g 9 "Entered function."" (procedure "programExit" line 3) invoked from within "programExit 0" How the heck is this even possible?? Is this a bug in Tcl? I don't see how anything we could do could ever cause [ info exists ] to return an empty string! Regards, Markus On Jun 22, 5:51=A0pm, antred <Nut...@gmx.net> wrote: > Hello, > > We're using "Tcl 8.4.4.0 Solaris/SPARC" .... pretty darned old > version, I know ... but we have no choice as our program doesn't work > well with newer versions. > > Anyway, we keep getting an error that we all used to think was simply > impossible ... namely [ info exists ] not returning zero or non-zero > but simply returning an empty string: > > can't use empty string as operand of "!" > =A0 =A0 while executing > "if { ! [ info exists ::var...

problem with "file executable" on windows, tcl 8.5.2
ActiveState TCL 8.5.2, Windows XP SP2 'file executable' always returns 0, even on .exe and .bat when asked for a file on a network share: % info patchlevel 8.5.2 % set file L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/gen.exe L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/gen.exe % file exists $file 1 % file readable $file 1 % file executable $file 0 % file executable {L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/simenu.bat} 0 However, when copying the files to local disk, the files are qualified as executable: % cp L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/simenu.bat d:/temp % file executable d:/temp/simenu.bat 1 % cp L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/gen.exe d:/temp % file executable d:/temp/gen.exe 1 Also: % set argv0 D:/Programme/tcl/bin/tclsh85.exe % file executable $argv0 1 The L:/ Network Share is an Samba share mounted from a linux box. Are there any special requirements for the smb options? Thanks R' Ralf Fassel said on 24/04/2008 21:21: > ActiveState TCL 8.5.2, Windows XP SP2 > > 'file executable' always returns 0, even on .exe and .bat when asked > for a file on a network share: > The L:/ Network Share is an Samba share mounted from a linux box. I have opened a similar report some time ago for file readable on a Samba share. Still open. See: http://sourceforge.net/tracker/index.php?func=detail&aid=1613456&group_id=10894&...

Is "String s = "abc";" equal to "String s = new String("abc");"?
In my opinion,"String s = "abc";" has only created a reference s not a object."String s= new String("abc");" has created a new object and its reference is s.Is it right?If I'm right,I still have a question.When I can use first one not need the second one? Bruce Sam wrote: > In my opinion,"String s = "abc";" has only created a reference s not a > object."String s= new String("abc");" has created a new object and its > reference is s.Is it right? Not really. Both declare a reference, and while the fi...

missing "lappend" from tcl 8.4.2.0 help .chm
I just noticed this tonight when I went to cross reference the windows help on lappend ,with the Brent Welch's 4th edition text.I'm sure this was fixed in newer releases. Love the book ,it's lighter with thinner pages ,the 3rd ed got me started ,now the 4th ed is THE tcl book ! keep em coming Brent ,nice to see Jeff Hobbs credited on this one too ,thanks. NeuroS wrote on 06/08/03: > err if you do a search you will find it , > 'Built-In Commands - lappend manual page. > just not listed in with other list cmds. That is very confusing. lappend should be listed ...

Problem with TDBC in Tcl 8.6.0: version conflict for package "TclOO"
Hi, I've got a problem with Tcl 8.6.0. I tried to run my tcls-script, but received the following error: version conflict for package "TclOO": have 0.7, need 1.0.1 while executing "load c:/tcl_x86/lib/teapot/package/win32-ix86/lib/tdbc_mysql1.0.0/tdbcmysql100.dll tdbcmysql" ("package ifneeded tdbc::mysql 1.0.0" script) invoked from within "package require tdbc::mysql " (file "myscript.tcl" line 4) Looks like the problem is in tdbc. I have already tried to install another version of tdbc, but it didn't help. This problem occures only in 8.6.0 Tcl version. Can anybody help me? Am Montag, 21. Oktober 2013 15:38:51 UTC+2 schrieb gama...@gmail.com: > Hi, > > I've got a problem with Tcl 8.6.0. I tried to run my tcls-script, but received the following error: > > > > version conflict for package "TclOO": have 0.7, need 1.0.1 > > while executing > > "load c:/tcl_x86/lib/teapot/package/win32-ix86/lib/tdbc_mysql1.0.0/tdbcmysql100.dll tdbcmysql" > > ("package ifneeded tdbc::mysql 1.0.0" script) > > invoked from within > > "package require tdbc::mysql " > > (file "myscript.tcl" line 4) > > > > Looks like the problem is in tdbc. I have already tried to install another version of tdbc, but it didn't help. This problem occures o...

"string map" causes problems with german umlauts since version tcl8.4
Since years I use TCL as an integrated scripting language in a software solution (Windows, MFC-Applikation). At least I stepped over from TCL 8.3.5 to TCL 8.4.14. But with this version I have problems with the command "string map" and german umlauts. I think the behaviour has changed. Example: set a "=E4=F6=FC" set x [string map {. ,} $a] x receives "=C3=A4=C3=B6=C3=BC". The string will change to unicode, where T= CL 8.3 keeps the string unchanged. The shell (tclsh84.exe) keeps the string unchanged, too. My MFC applikation has the following few lines in the initialization part, which is similar to the shell.: Tcl_SetDefaultEncodingDir( ... ); Tcl_FindExecutable( ... ); interp =3D Tcl_CreateInterp(); Even when I insert the line setlocale(LC_ALL, "C"); which I found in the main() function of the source code from the shell doesn't solve the problem. Of course I could change my tcl scripts like this set a "=E4=F6=FC" set x [encoding convertfrom identity [string map {. ,} $a]] ..=2E. but I have a lot of scripts and additional I fear that other string functions probably have the same problem. I need a solution where I could set the interpreter to a mode that it doesn't change my strings in unicode, exactly like the old version. BTW: I have to use TCL 8.4 because of multi threading, which works fine in TCL 8.4 but doesn't in TCL 8.3. I checked this with Tcl 8.4.3 under Linux a...

Tcl {string "...$var"}
Hello everybody! Simple newbie question: In this command the variable $vbox_caller_id is interpreted as string. But I need it interpreted as variable. set res [xmlrpc::call "http://10.0.0.1:4711/" "jabber.send" {{string message@jabber.org} {string "VoiceBox"} {string "New Mail from $vbox_caller_id"}}] I would be very happy about some correct code.... thanks! Johannes Morgenroth <jm@m-network.de> wrote: > In this command the variable $vbox_caller_id is interpreted as string. But I > need it interpreted as variable. > &...

problem with "sorting" in tcl
Hi, Not a master of tcl, I would like to find a solution to the following problem asap. I want to sort a list of numbers. Please see this code ################## set bw [list] set b 6 puts "length: [llength $bw]" for {set i 0} {$i < $b } {incr i} { lappend bw [expr $b-$i] } puts "length: [llength $bw]" lsort -real $bw puts "list is: $bw" ################### Problem: I expect (and I need) that it should give the list as 1 2 3 4 5 6 but the output produced is length: 0 length: 6 list is: 6 5 4 3 2 1 Can anyone advice on what do I need to do so that after sorting the output is "sorted" really..?? thank you. On 2006-03-13, Kamal <kamal.program@gmail.com> wrote: > lsort -real $bw Here's your problem. The lsort man page states: This command sorts the elements of list, returning a new list in sorted order. You're sorting the contents of variable "bw" as a list -- and throwing the sorted list (ie. the return value) away. The above should read: set bw [lsort -real $bw] Also, you don't actually need the "-real" option here, unless you're expecting floating-point values. "-integer" works just fine for the example dataset you presented. - Adrian Kamal wrote: > Hi, > Not a master of tcl, I would like to find a solution to the following > problem asap. I want to sort a list of numbers. Please see this code > > ################## > set bw [list] > se...

"""""""""ADD ME""""""""""
Hi , Hope you are doing great. Please let me take this opportunity to introduce myself, Iam Karthik working with BhanInfoi Inc, a NY based company. We have consultants on our bench on various technologies, my request is to add me to your distribution list and kindly do send me the requirements. i have the below list available 1. Mainframe 2. Java 3.. Financial Analyst 4. Data Architect If there is any vendor ship agreement which has to be signed then I would like to take an opportunity to represent my company and expect your cooperation... ...

ANN: Tcl-Tk-Aqua 8.4.14 "universal" installer for OS X
The Tcl/Tk "Universal" packages are distributions of the core Tcl/Tk libraries, plus the Tile theming extension, built to support the PPC and Intel architectures of the Mac OS X platforms. They can be downlaoded at http://tk-components.sourceforge.net/installer/index.html. OVERVIEW OF PACKAGES The Tcl/Tk "Universal" package for Mac OS X are based on the current version of Tcl/Tk at the time of this build, 8.4.14. The Tile extension is version 0.7.8. The packages support the native Aqua version. Aqua The "Aqua" package supports the native Mac windowing environment. It is useful for developing and deploying native Mac OS X applications. With the "Aqua" package, the following will be installed on your machine: *The Tcl and Tk frameworks will be installed in /Library/Frameworks. * The Tcl interpreter, tclsh, and the Tk interpreter, wish, will be installed in /usr/local/bin. *The Tile extension, which adds native Aqua theming to the Tk widgets, will be installed in /Library/Tcl. * The Wish application package will be installed in /Applications/Utilities. A standalone version of Wish, with the Tcl/Tk and Tile libraries embedded in the application package, will be installed in /Applications/Utilities/Wish-Embedded. This package is useful for deploying Tcl/Tk applications to end users.The Tcl/Tk "Universal" packages are distributions of the core Tcl/Tk libraries, plus the Tile theming extension, built to support...

Tcl 8.4 regexp bug ("can't happen -- you found a bug")
Howdy, The following regsub command causes the above error message in Tcl 8.4: regsub {(^|\n)+\.*b} \n.b "" tmp There's probably room for argument about whether the expression is malformed. But in that case, it should probably say "quantifier operand invalid" rather than "you found a bug". Good luck, -Jonathan Jones According to Jonathan Jones <googlegroups@spitzensparken.com>: :The following regsub command causes the above error message Stop by the SourceForge project and submit a bug report on it. -- <URL: http://wiki.tcl.tk/ > In Go...

3 problems with "A small editor in 8.5.0" ( http://wiki.tcl.tk/20542)
I'm using Tcl/Tk 8.6.4 under WinXP Pro. Problem 1. I don't see any where to specify desired font. There is a code fragment saying ----------- proc textfenster {mframe {master {}}} { if {$master eq {}} { text [set mframe].t -bg white -xscrollcommand [ ---------------------------- which I edited to be ----------- proc textfenster {mframe {master {}}} { if {$master eq {}} { text [set mframe].t -font "Courier 20" -bg white -xscrollcommand [ ---------------------------- It made no difference. Problem 2. Although moving the butto...

Writing a "String#jindex" method to do the same for "index" as "String#jlength" does for "length"
So I've been using the 'jcode' library to get UTF-8 support and wanted to add a convenience method called "jindex" that would work with multi- byte characters in much the same way that "jlength" does. The basic idea is to call the real "index" method to do the work, and then convert the returned byte-count index into a character-count index before returning it to the user. This works fine, but the problem is that I can't find a way to propagate $~ back to the user. That is, after calling this: 'foo'.index /foo/ $~ is set and $~[0] is &q...

Javadoc including "java.lang.String" instead of just "String" for return values
How does one get the javadoc utility to show just "String" instead of "java.lang.String" in its output? I've noticed that, for example, Sun's "awt.TextField.ParamString()" method is documented as follows, and I'd like to make mine appear this way for extremely well-known objects such as "String" as well: protected String paramString() Thanks in advance. -- Randolf Richardson - kingpin+nntp@lumbercartel.ca The Lumber Cartel, local 42 (Canadian branch) http://www.lumbercartel.ca/ Randolf Richardson wrote: > How does one...

"pipe" in Tcl 8.5ff
Hi, I am looking for a replacement of the "pipe" command of tclx. This command creates a FIFO and returns one fd for reading and one for writing. A similar command in C is #include <unistd.h> int pipe(int pipefd[2]); How do I do that with plain Tcl (version >= 8.5)? Best regards Ole Στις 8/8/2013 2:38 μμ, ο/η Olе Streicher έγραψε: > Hi, > > I am looking for a replacement of the "pipe" command of tclx. This > command creates a FIFO and returns one fd for reading and one for > writing. A similar command in C is > > #include <unistd.h> > int pipe(int pipefd[2]); > > How do I do that with plain Tcl (version >= 8.5)? > > Best regards > > Ole > In tcl 8.6, with the "chan pipe" command. In tcl 8.5, with the tclpipe extension: http://wiki.tcl.tk/21637 If you need this for executing commands, see the man page for "open" and possibly "exec". George Hi George, George Petasis <petasisg@yahoo.gr> writes: > Στις 8/8/2013 2:38 μμ, ο/η Olе Streicher έγραψε: >> I am looking for a replacement of the "pipe" command of tclx. > In tcl 8.6, with the "chan pipe" command. In tcl 8.5, with the tclpipe > extension: > > http://wiki.tcl.tk/21637 Is there a way to do it in plain tcl, without the need to compile an external package? > If you need this for executing commands, ...

"Multithreaded" tcl/tk problem?
Hello In short: I ran into serious problems when developing multithreded Tcl/ Tk application in C. After spending (literally!) weeks on debugging and tests, I believe that it narrows down to Tcl/Tk bugs in multithread mode. I tried to find something over net on such problems, but to no success :-( I'll be very grateful if someone could confirm that, or perhaps point out what I'm doing wrong...here's detailed description: I have Win32 C++ application (SCADA/HMI program) which may contain several (from zero to literally hundreths) independent Tcl/Tk "modules". Module is my own term here, and it boils down to separate thread, with it's own tcl interpreter. I also create a "container window" in module's thread, and initialize Tk in this interpreter (via Tk_Init) so that "container window" becomes parent window for this Tk's instance "main window" (this is done via setting global "argv" variable to "-use container_id"). After initialization, thread load script from file into interpreter and enters fairly standard event loop, processing both windows messages and Tcl events. Some of messages (defined by RegisterWindowsMessage) are used to carry commands from other threads - when I receive such message I call some Tcl function in interpreter, by usual Tcl_Eval( "functionName" ) call. This code in turn does some Tcl work, like setting GUI up, displaying information for the user, sometimes i...

TCL "info globals" problem
I've hit an odd problem with TCL on a 64-bit installation of SuSE Linux 9.3. The problem is that the "info globals" command is returning a non-null result for an undefined global, when it should be returning a null result. Furthermore, it only does this inside a proc. For example, try this command sequence from the tclsh command prompt: proc Try {} {global Glob; info globals Glob} Try Assuming that there is no global variable named "Glob", this returns an empty result on a 32-bit system, but it returns "Glob" on a 64-bit system! tcl_version is 8...

"out" and "in out"
Hi i found the following explaination: In Ada, "in" parameters are similar to C++ const parameters. They are effectively read-only within the scope of the called subprogram. Ada "in out" parameters have a reliable initial value (that passed in from the calling subprogram) and may be modified within the scope of the called procedure. Ada "out" parameters have no reliable initial value, but are expected to be assigned a value within the called procedure. What does "have no reliable initial value" mean when considering the "out" parameter? By c...

"or" and "and"
Hi, I'm just getting to discover ruby, but I find it very nice programming language. I just still don't understand how the "or" and "and" in ruby... I was playing with ruby and for example made a def to print Stem and Leaf plot (for those who didn't have a statistics course or slept on it, e.g. http://cnx.org/content/m10157/latest/) Here is the Beta version of it: class Array def n ; self.size ; end def stem_and_leaf(st = 1) # if st != (2 or 5 or 10) then ; st = 1 ; end k = Hash.new(0) self.each {|x| k[x.to_f] += 1 } k = k.sort{|a, b| a[0].to_f <=&g...

"my" and "our"
Hi, while testing a program, I erroneously declared the same variable twice within a block, the first time with "my", the second time with "our": { my $fz = 'VTX_Link'; .... ( around 200 lines of code, all in the same block) our $fz = 'VTX_Linkset'; ... } So the initial contents of the $fz declared with "my" is lost, because "our" creates a lexical alias for the global $fz, thus overwriting the previous "my" declaration. It was my error, no question. But I wonder why Perl doesn't mention this - even with "use s...

"a string".xor("another string")
I want to do an XOR of two strings: "a string".xor("another string") It's not that hard to implement, but it's not fast either, since it walks through the data string, byte-by-byte. Any ideas? For example: "It's memory-hungry!". Any solutions? gegroet, Erik V. - http://www.erikveen.dds.nl/ ---------------------------------------------------------------- class String def xor(other) if other.empty? self else a1 = self.unpack("c*") a2 = other.unpack("c*") a2 *= 2 while a...

about "++" and "--"
why this program snippet display "8,7,7,8,-7,-8" the program is: main() { int i=8; printf("%d\n%d\n%d\n%d\n%d\n%d\n",++i,--i,i++,i--,-i++,-i--); } > why this program snippet display "8,7,7,8,-7,-8" Ask your compiler-vendor because this result is IMHO implementation-defined. Check this out: http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.15 http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.16 Regards, Irina Marudina fxc123@gmail.com wrote: > why this program snippet display "8,7,7,8,-7,-8&q...

Web resources about - "string map" Probleme in tcl 8.4 mit Umlauten? - comp.lang.tcl

Resources last updated: 3/13/2016 2:40:57 PM