On Thursday, 26 December 2013 at 05:39:26 UTC, Lionello Lunesu
wrote:
On 12/26/13, 11:58, bearophile wrote:
Lionello Lunesu:
I could have sworn this used to work. Is my memory failing
me, or was
this a deliberate change at some point? Perhaps a regression?
It's not a regression, it's a locked-in design mistake. Write
it like
this and try again:
foreach (dchar d; "你好")
Bye,
bearophile
Yeah, that's what I ended up doing. But D being D, the default
should be safe and correct.
It is impossible for it to be "correct", unless with a very
specific definition of "correct" which makes sense for some
languages/locales and not others. As a challenge, try to define a
"foreach" semantic that works "correctly" with the OP's code for
Unicode composite characters, or Hebrew.