dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Mon Nov 8 13:09:36 UTC 2021
On Monday, 8 November 2021 at 12:32:08 UTC, FeepingCreature wrote:
> Generally, you're reading data that someone wrote for a reason,
> and ReplacementCharacter would almost universally indicate that
> there was something you were meant to pick up on but failed to
> handle. As such, it's much less clear to me whether there even
> are cases where "text with replacement characters" or "text
> with replacement characters removed" is even useful.
It could mean that someone did cut'n'paste of text from a more
recent version of the Unicode standard. ReplacementCharacter
makes it possible for you to use the input regardless (replacing
it with a question mark in a square or something).
I think this is an application level feature, and not a language
level feature, so it doesn't make sense for the language to do
this IMO. That we can agree on.
(D is not a scripting langauge.)
More information about the Digitalmars-d
mailing list