A D vs. Rust example

rikki cattermole rikki at cattermole.co.nz
Fri Oct 28 00:04:05 UTC 2022


On 28/10/2022 12:55 PM, H. S. Teoh wrote:
>> A better approach is to have the string processing be tolerant of
>> invalid UTF-8.
> Which makes string-processing code more fragile and possibly more
> complex. Better to let the standard library replace all invalid
> sequences with the replacement character so that downstream code doesn't
> have to worry about it anymore.

Officially you are meant to support only well formed UTF and anything 
else you are expected to reject.

In practice yes, replacement character can be what you decode (which is 
what I do).


More information about the Digitalmars-d mailing list