Re: Rename files using IDL - is it possible? [message #72072 is a reply to message #72010] |
Thu, 12 August 2010 14:12   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
Hi all,
Okay, IDL 7.1.2 and IDL 8.0 fix the original poster's problem, with
testAAA.txt (where A is the A with the ring). Using either
DIALOG_PICKFILE or hard-coded, IDL 8.0 will successfully delete the
file.
Now, regarding Heinz's problem - this is unfortunately a pathological
case, where the 195+133 happens to be the UTF-8 encoding for the
extended ASCII character for 197 (the A with the ring).
Internally, IDL tries to recognize UTF-8 strings by the rules for
UTF-8 encoding. If the first byte is > 193, and the second byte is
between 128-191, then IDL assumes that this is a UTF-8 string. The
file I/O routine then converts the filename to UTF-8 encoding, which
converts the 195+133 to 197, and therefore ends up with the same
filename.
Our UTF-8 conversion routines are based upon the UTF-8 standard, and
are designed to the best of our ability to work with multiple
languages and encodings, including European and Asian languages.
Unfortunately, given a random string of bytes, there is no way to
definitively determine that this is a UTF-8 versus native string.
Hopefully, the case given by Heinz will occur rarely if ever.
Cheers,
Chris
ITTVIS
|
|
|