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 >
