The Case Against Autodecode

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu May 12 17:59:45 PDT 2016


On 5/12/2016 4:52 PM, Marco Leise wrote:
> I'd like 'string' to mean valid UTF-8 in D as far as the
> encoding goes. A filename should not be a 'string'.

I would have agreed with you in the past, but more and more it just doesn't seem 
practical. UTF-8 is dirty in the real world, and D code will have to deal with it.

By dealing with it I mean not crash, throw exceptions, or other tantrums when 
encountering it. Unless it matters, it should pass the invalid encodings along 
unmolested and without comment. For example, if you're searching for 'a' in a 
UTF-8 string, what does it matter if there are invalid encodings in that string?

For filenames/paths in particular, having redone the file/path code in Phobos, I 
realized that invalid encodings are completely immaterial.



More information about the Digitalmars-d mailing list