issues with non-ASCII characters vs. "do shell script"
issues with non-ASCII characters vs. "do shell script"
- Subject: issues with non-ASCII characters vs. "do shell script"
- From: Bill Hoffman <email@hidden>
- Date: Thu, 31 Jan 2002 18:38:15 -0800
There are still issues with non-ASCII characters vs. "do shell script",
but that's a different problem.
The problem as I've experienced it is:
this is a filename as it appears in the Finder :
'Peter Rowan andeadow Green.mp3'. Note the single ellipsis character
(ascii 201 \xC9).
this is the filename as it get passed to the shell as an AS variable or
string literal from a 'do shell script' command:
'Peter Rowan andeadow Green.mp3'. Same as above. (I used quoted form of
POSIX path of ...)
this is the filename as it appears in the Terminal after an 'ls -al'
command:
"Peter Rowan and???eadow Green.mp3" : hmm....three chars and not one??
this is the filename as returned from a do shell script "ls -al *.mp3"
command:
"Peter Rowan andD6eadow Green.mp3" : yes, it's the iso8859-1
representation of the utf-8 encoding of the ellipsis char
this is the filename as returned from a 'glob *.mp3' style command in a
shell script (Tcl in this case...)
"Peter Rowan andD6eadow Green.mp3" : now we know what the file system
encoding is, don't we
So if you pass a filename with a high-bit ascii char in it (or, try
Kanji in filenames for even more fun) and expect your shell script to be
able to read that file and do something with it, it will fail with a
"file does not exist" error.
You could, of course, do a charset encoding transfer of the filename to
a utf-8 encoding within your shell script, provided that a) you have the
facility to do this, b) you know exactly which encoding to convert from,
or .... arrgghhh I give up! c) wait for the good folks at Apple to fix
this as they should and no doubt will at some point in the future.
Please.
Display format of the above filename samples may vary with your email
client, or not...I'm not sure.
cheers,
xbhoff
PS: {artist: 'Peter Rowan', title: 'Meadow Green', description:
'fabulously talented blugrass vocalist'} for those who are curious
PPS: Yes, it's a crappy carbonized Gnutella client that stuffs an
ellipsis into the filename like that. Sheesh.