A D vs. Rust example

Walter Bright newshound2 at digitalmars.com
Thu Oct 27 23:37:12 UTC 2022


On 10/24/2022 1:04 PM, Dukc wrote:
> it's UTF-8 string type. Not only it is 
> guaranteed to point to valid memory, it is statically guaranteed to point to 
> valid UTF-8!
The trouble with that is much of the UTF-8 out there is not valid. You don't 
want, for example, your html page to refuse to display at all because there's a 
couple invalid UTF-8 sequences in it. You don't want your text editor to refuse 
to load a file with invalid UTF-8 in it, either. You don't want your forms 
processor to summarily reject anything with invalid UTF-8 in it.

A better approach is to have the string processing be tolerant of invalid UTF-8.


More information about the Digitalmars-d mailing list