|
2024-08-28
| ||
| 13:42 | • Ticket [db4f2843cd] Sporadic segfault (BO) using tclIO status still Closed w... artifact: a4eb53a04d user: pooryorick | |
|
2020-03-16
| ||
| 13:05 | • Closed ticket [8f89e2e059]: Windows: environment is not reflected properly (spec... artifact: 144c1f69ac user: sebres | |
|
2020-03-14
| ||
| 21:02 | Fix [8f89e2e059aafa1c]: Windows: environment is not reflected properly (special characters). Thanks ... check-in: 8fc411cdb8 user: jan.nijtmans tags: core-8-6-branch | |
|
2020-03-13
| ||
| 15:38 | • Ticket [8f89e2e059] Windows: environment is not reflected properly (special char... artifact: 3917586aab user: sebres | |
| 15:03 | • Ticket [8f89e2e059]: 3 changes artifact: b8c8e7d95e user: jan.nijtmans | |
| 13:10 | • Pending ticket [8f89e2e059]. artifact: e590634ee7 user: sebres | |
| 13:06 | env.test: added test for windows illustrating bug [8f89e2e059] - loss of multi-byte chars in environ... check-in: dcf2c77048 user: sebres tags: bug-8f89e2e059 | |
|
2020-03-12
| ||
| 18:22 | • Ticket [8f89e2e059] Windows: environment is not reflected properly (special char... artifact: 26c9be38b0 user: sebres | |
| 15:01 | • Ticket [8f89e2e059]: 3 changes artifact: 582d040d1f user: bll | |
|
2020-03-11
| ||
| 10:49 | • Ticket [8f89e2e059]: 3 changes artifact: f4ed6a0c8f user: sebres | |
|
2020-03-10
| ||
| 23:33 | • Ticket [8f89e2e059]: 3 changes artifact: 0615cd1cb7 user: bll | |
| 22:54 | • Ticket [8f89e2e059]: 3 changes artifact: e83fb5ffad user: bll | |
| 22:04 | • New ticket [8f89e2e059]. artifact: fbb2a53754 user: bll | |
Windows: environment is not reflected properly (special characters)
If you want to try this in cmd.exe, be sure to set the cmd.exe font to "Lucida Console". I don't have the hungarian locale, so the locale is set to US. I ran a [glob -directory C:/Users *] and the proper value is returned. C:\Users\Gergő\Desktop\BallroomDJ>.\windows\64\tcl\bin\tclsh.exe % puts $::env(USERPROFILE) C:\Users\Gergo % exit C:\Users\Gergő\Desktop\BallroomDJ>echo %USERPROFILE% C:\Users\Gergő C:\Users\Gergő\Desktop\BallroomDJ>
dcf2c77048env.test: added test for windows illustrating bug [8f89e2e059] - loss of multi-byte chars in environment if single-byte system encoding used check-in2020-03-13 13:06:53
I tried chcp 1250 and no better.
Note that 'Gergő' is using some windows code page, not utf-8. So there are all sorts of problems using windows account names with special characters, as you can very easily get mixed encodings within path names.
The code page of console does no matter, neither for supplying environment parameters nor for the substitution of them. Currently tcl uses a system encoding to convert environment to utf-8. So (unless it is fixed) you can set it to something better matching your locale (I guess cp1252)... I believe cp437 is not really suitable for Hungarian locale.
Note that in example below I changed console CP (to utf-8) only in order to see proper output for different encodings (it does not affect the system encoding).
As you can see the value gets changed related to the system encoding currently used.
> chcp 65001
> set TEST=--äöüß-- && tclsh86
% puts [encoding system]\t$env(TEST)
cp1252 --äöüß--
% encoding system cp437
% puts [encoding system]\t$env(TEST)
cp437 --Σ÷ⁿ▀--
% encoding system cp1251
% puts [encoding system]\t$env(TEST)
cp1251 --дцьЯ--
This behavior can (and I guess, must) be changed since Windows has a wide-char functions to obtain environment...
I have already fixed that in my own fork and would take a look whether it can be back-ported without compat issues.
Even with the correct system encoding set on the command line, the environment isn't picked up properly. I hope your fixes can be applied. I don't expect that special characters in the account name will ever work well due to mixed encodings in the path name, but having environment variables that are not valid at all is definitely wrong. C:\Users\Gregő\Desktop\BallroomDJ>.\windows\64\tcl\bin\tclsh.exe -encoding cp1250 % puts $::env(USERPROFILE) C:\Users\Grego % puts [file exists $::env(USERPROFILE)] 0 %
1. You cannot change the system encoding via command line parameter - this specifies only the char-set of the content of given script (so basically loads the file with proper encoding only):
# this does not change system encoding: > echo puts [encoding system] | tclsh86 -encoding utf-8 cp1252 # this will load "main.tcl" using utf-8, but also does not change sys-encoding: > echo puts [encoding system] > %TEMP%\main.tcl > tclsh86.exe -encoding utf-8 %TEMP%\main.tcl && del %TEMP%\main.tcl cp1252So you have either to set it properly in the system or in the main script self.
2. I tried to back-port my "fix" and got many conflicts I have still to resolve (and I'm pretty sure I get some things in env.test that I have to correct too)... be patient.
Fix is provided in branch [bug-8f89e2e059] (tested for windows only with make-build)
Tested now on Visual Studio too. Made some additional fixes. I think it's good to be merged to 8.6. Thanks!
Ok, let us see what Travis will say about the branch :)
Merged, thus close. Thx, Jan!