[Issue 14519] [Enh] foreach on strings should return replacementDchar rather than throwing

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 28 23:13:38 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14519

Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang at jmdavisProg.co
                   |                            |m

--- Comment #2 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Vladimir Panteleev from comment #1)
> As discussed in the newsgroup: please don't do this.

If anything, I thought that the consensus lead towards making the change, but
maybe I didn't pay enough attention to the discussion in question.

Certainly, I'm very much in favor of making use of replacementDchar on invalid
UTF in general and have code explicitly validate unicode if that's what's
desired. There is some risk with making the change, since existing code may not
handle the replacement character well, but very little string processing is
going to actually care, and throwing exceptions like we currently do is not
only a performance problem, it's hugely annoying when you need to actually
process invalid unicode, which is pretty easy to have happen if you're doing
stuff like parsing websites or files which were written by programs that didn't
handle unicode correctly.

--


More information about the Digitalmars-d-bugs mailing list