D's Auto Decoding and You

Andrei Alexandrescu via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jun 2 14:33:02 PDT 2016


On 6/2/16 5:27 PM, Steven Schveighoffer wrote:
> On 6/2/16 5:21 PM, jmh530 wrote:
>> On Tuesday, 17 May 2016 at 14:06:37 UTC, Jack Stouffer wrote:
>>>
>>> If you think there should be any more information included in the
>>> article, please let me know so I can add it.
>>
>> I was a little confused by something in the main autodecoding thread, so
>> I read your article again. Unfortunately, I don't think my confusion is
>> resolved. I was trying one of your examples (full code I used below).
>> You claim it works, but I keep getting assertion failures. I'm just
>> running it with rdmd on Windows 7.
>>
>>
>> import std.algorithm : canFind;
>>
>> void main()
>> {
>>     string s = "cassé";
>>
>>     assert(s.canFind!(x => x == 'é'));
>> }
>
> If that é above is an e followed by a combining character, then you will
> get the error. This is because autodecoding does not auto normalize as
> well -- the code points have to match exactly.
>
> -Steve

Indeed. FWIW I just copied OP's code from Thunderbird into Chrome (on 
OSX) and it worked: https://dpaste.dzfl.pl/09b9188d87a5

Should I assume some normalization occurred on the way?


Andrei



More information about the Digitalmars-d-announce mailing list