| Ticket UUID: | 956433 | ||
| Title: | [glob] fails conversion to internal encoding | ||
| Type: | Bug | Created on: | 2004-05-19 02:46:59 |
| Submitter: | dgp | Assigned to: | das |
| Subsystem: | 37. File System | Severity: | |
| Priority: | 5 Medium | Last modified: | 2005-03-10 18:50:31 |
| Status: | Closed | Closed by: | das |
| Resolution: | Duplicate | Closed on: | 2005-03-10 11:50:31 |
| Version: | obsolete: 8.5a1 | ||
| Description: | ||||
On a Mac OS X system: % encoding system utf-8 % glob * no files matched glob pattern "*" % set s \u00e9 é % string bytelength $s 2 % close [open $s w] % set f [glob *] é % string bytelength $f 3 % binary scan [encoding convertto identity $s] c* bytes; set bytes -61 -87 % binary scan [encoding convertto identity $f] c* bytes; set bytes 101 -52 -127 I start with the character \u00E9 in its 2-byte internal encoding: xC3 xA9 Write a file with that name, and retrieve the file name with [glob] and I get a different representation: x65 xCC x81 which is our internal encoding for \u0065 \u0301 % format %s \u00E9 é % format %s \u0065\u0301 é those outputs look the same in the interactive shell, but not in this browser text entry. | ||||
| User Comments: | ||||
dgp added on 2004-05-19 20:39:31:
Logged In: YES user_id=80530 A worse symptom is that [glob f??] and [glob f\u00E9?] both fail to return the file. dgp added on 2004-05-19 22:19:29:
Logged In: YES user_id=80530 oops, changed examples in mid-stream. I think I meant to complain that [glob ?] fails to return the file, but I'm not on a system where I can verify that. kbk suggests the answers to this issue may lie at: http://www.unicode.org/reports/tr15/ vincentdarley added on 2004-05-19 22:44:11:
Logged In: YES user_id=32170 I believe this is a duplicate of bug 823330, which Daniel Steffen is the expert on! das added on 2004-05-19 23:00:10:
Logged In: YES user_id=90580 indeed, this is a syptom of bug 823330: tcl does not know about unicode normalization, in particular how to deal with decomposed unicode, which is the system encoding on Mac OS X, i.e. the encoding used by the posix API to communicate with the filesystem: Composed unicode input to the filesystem will return as decomposed unicode on Mac OS X. My proposed solution is for the system encoding on OSX to compose all input before passing it higher up. Unfortunately, composing utf8 (as oppposed to utf32) is non trivial in a stream interface as needed for a tcl encoding... My effort to implement this has currently stalled, somebody else is most welcome to have a go; otherwise I'll get back to it at some point, it's on the todo list... It might be worthwile for somebody to devise a general solution to how tcl deals with unicode normlizatoin, including all normalization forms, not just NFC and NFD like we need in this context. das added on 2005-03-10 18:50:31:
Logged In: YES user_id=90580 closed as duplicate of bug 823330: http://sourceforge.net/tracker/? func=detail&aid=823330&group_id=10894&atid=110894 | ||||
