|
2023-09-13
| ||
| 12:42 | • Closed ticket [43b0656605]: MS Windows: files with emojis are found by glob but ... artifact: 5f95686745 user: jan.nijtmans | |
| 12:38 | Fix [43b0656605]: MS Windows: files with emojis are found by glob but not recognized by file exists ... check-in: 87eae2f450 user: jan.nijtmans tags: core-8-6-branch | |
| 12:09 | • Ticket [43b0656605] MS Windows: files with emojis are found by glob but not reco... artifact: 491a5cce6f user: oehhar | |
| 11:45 | • Ticket [43b0656605]: 4 changes artifact: ab7d12de9a user: oehhar | |
| 11:11 | • Ticket [43b0656605]: 3 changes artifact: 4e56947681 user: jan.nijtmans | |
| 11:00 | Fix [43b0656605]: MS Windows: files with emojis are found by glob but not recognized by file exists ... closed check-in: e22d09505b user: jan.nijtmans tags: bug-43b0656605 | |
|
2023-09-11
| ||
| 08:25 | • Ticket [43b0656605] MS Windows: files with emojis are found by glob but not reco... artifact: b9a63bd41e user: jan.nijtmans | |
| 07:02 | • Ticket [43b0656605]: 4 changes artifact: d070e3b9f4 user: oehhar | |
|
2023-09-09
| ||
| 14:29 | • Ticket [43b0656605]: 3 changes artifact: d2c2124251 user: msoyka | |
| 13:43 | • Ticket [43b0656605]: 3 changes artifact: 638620641e user: juliannoble2 | |
| 13:30 | • Ticket [43b0656605]: 3 changes artifact: 62cd2be2b1 user: juliannoble2 | |
| 12:15 | • New ticket [43b0656605]. artifact: c998f36518 user: oehhar | |
| Ticket UUID: | 43b065660532eb4a3678e70e9d68daf1b09810ac | ||
| Title: | MS Windows: files with emojis are found by glob but not recognized by file exists or open | ||
| Type: | Bug | Created on: | 2023-09-09 12:15:00 |
| Submitter: | oehhar | Assigned to: | jan.nijtmans |
| Subsystem: | 37. File System | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2023-09-13 12:42:32 |
| Status: | Closed | Closed by: | jan.nijtmans |
| Resolution: | Fixed | Closed on: | 2023-09-13 12:42:32 |
| Version: | 8.6.13 | ||
| Description: | ||||
|
Ref: Thread on clt titled: "Problem with filenames that include emoji characters" Issue: Files with Emojis are found by glob but may not be opened and "file exists" return 0. Platform: Windows only To reproduce:
% cd c:/test
% set l [glob *]
{NEXT SAT. 2_15_ FADED LOVERS TOUR in PROVIDENCE! 💕💞💕.eml}
% set f [lindex $l 0]
NEXT SAT. 2_15_ FADED LOVERS TOUR in PROVIDENCE! 💕💞💕.eml
% file exists $f
0
% open $f r
couldn't open "NEXT SAT. 2_15_ FADED LOVERS TOUR in PROVIDENCE! 💕💞💕.eml": filename is invalid on this platform
System:
Thank you all! Harald | ||||
| User Comments: | ||||
juliannoble2 added on 2023-09-09 13:30:31:
Interestingly while open/read/stat etc don't work file attributes does.
P% file attributes $f
- -longname {NEXT SAT. 2_15_ FADED LOVERS TOUR in PROVIDENCE! 💕💞💕.eml} -shortname NEXTSA~1.EML
P% file exists NEXTSA~1.EML
- 1
You also can't glob for an exact match: glob $f
Dos device pathnames don't help either:
P% file exists //?/[pwd]/$f
- 0
(note a full path is required for the //?/ syntax)
Everything works fine if you use the shortname - but it seems if that's the case maybe the windows file code should automatically try the shortname in these cases.
This is close, but *slightly* different to the behaviour you get when using what is considered an illegal path in windows. e.g a filename ending in . or a space.
These ones do work simply by using the //?/ syntax - but.. file attributes doesn't return the shortname info.
P% file exists [pwd]/testetc123aaa.
- 0
P% file exists //?/[pwd]/testetc123aaa.
- 1
P% file attributes [pwd]/testetc123aaa.
could not read "C:/test/testetc123aaa.": no such file or directory
p% file attributes //?/[pwd]/testetc123aaa.
- -archive 1 -hidden 0 -readonly 0 -system 0
Exact globs for trailing dot/space files also doesn't work.
It's obviously more important that the emoji names work than trailing dots or spaces which is a separate issue - I just thought the comparison with the //?/ workaround not working was interesting.
juliannoble2 added on 2023-09-09 13:43:53:
In tcl8.7 however - this with emojis works without issue that I can see. msoyka added on 2023-09-09 14:29:00:
In reference to Julian's comment regarding "file attributes", that command fails with "no such file or directory" on my Windows 10 system. However, I can confirm that "file exists" with the short filename does return 1. I apologize for adding my comments here instead of to Julian's but I couldn't find a way of doing it (little experience with fossil). oehhar added on 2023-09-11 07:02:32:
If it works on TCL 9.0, I am quite happy. That is anyway the aim. Emoji were always broken on TCL 8.6 and will never be really fixed. Many people happily use TCL 8.7 or even 9.0 where all this works. Or Undroidwish, where all this works to. Take care, Harald jan.nijtmans added on 2023-09-11 08:25:53:
The problem is here. The function MultiByteToWideChar() converts UTF-8 to UTF-16, but - in this case - the filename is not in UTF-8, it's CESU-8, because that's the encoding used internally in Tcl 8.6. In Tcl 8.7 and 9.0, Tcl uses (modified) UTF-8 in stead of CESU-8, that explains why it works there. Possible solution, convert from CESU-8 to UTF-8 (Tcl_UtfToExternal) first. jan.nijtmans added on 2023-09-13 11:11:35:
Proposed fix [e22d09505b1c2338|here] Remember that Tcl 8.6 uses CESU-8 as internal format, which cannot be fead directly to MultiByteToWideChar(). Tcl 8.7 and 9.0 use (modified) UTF-8 internally, that's why this 'fix' is for 8.6 only. >Emoji were always broken on TCL 8.6 and will never be really fixed ;-) oehhar added on 2023-09-13 11:45:11:
Jan, really great work! It works like a charme! I only tried with tclsh (did not build tk), where the console output of emojies do not work. But the glob to file relation works. I was not able to test with MS-VC6, due to [a1f11d96b8]. So, branch [e22d09505b1c2338] was tested with MS-VS2015 32 bit. The test suite is still running. I will report here, if there are any issues. IMHO, this may be merged. Take care, Harald oehhar added on 2023-09-13 12:09:59:
Running the test suite caused the file related tests in ticket [26fd1451b8] to fail. But the also fail in core-8-6-branch. Due to that, it is reported in a separate ticket. Harald jan.nijtmans added on 2023-09-13 12:42:32:
Fixed [87eae2f4507bc5cc|here] Closing | ||||
