If they are valid ASCII, aren't they automatically also valid UTF8? Or do you 
refer to strings with 8-bit characters that should e.g. be interpreted 
according to a particular code page?

-erik

On Jan 12, 2015, at 19:25 , [email protected] wrote:
> 
> Unfortunately operating systems are not very cooperative about the encoding 
> used for filenames in directories.  On some systems its UTF-8 on others it 
> isn't and others don't care and it depends on the mounted filesystem and so 
> can vary with which path you are using.  So if the names read are both valid 
> UTF8 and ASCII readdir() can't tell which is correct.  So a union is a 
> reasonable answer.
> 
> Cheers
> Lex
> 
> On Tuesday, January 13, 2015 at 4:59:12 AM UTC+10, [email protected] 
> wrote:
> Why does readdir return a Union of two different string types instead of a 
> consistent one?
> 
> julia> typeof(readdir("."))
> Array{Union(UTF8String,ASCIIString),1}
> 
> I was expecting Array{UTF8String,1} or Array{ASCIIString,1}. It's not a 
> serious issue but still quite unexpected.
> 
> Samuel

--
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/

My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu/.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to