D's Auto Decoding and You

jmh530 via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jun 2 20:01:44 PDT 2016


On Thursday, 2 June 2016 at 21:31:39 UTC, Jack Stouffer wrote:
> On Thursday, 2 June 2016 at 21:21:50 UTC, jmh530 wrote:
>> 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 == 'é'));
>> }
>
> Your browser is turning the é in the string into two code 
> points via normalization whereas it should be one. Try using 
> \u00E9 instead.

That doesn't cause an assert to fail, but when I do  
writeln('\u00E9') I get é. So there might still be something 
wonky going on. I looked up \u00E9 online and I don't think 
there's an error with that.


More information about the Digitalmars-d-announce mailing list