D's Auto Decoding and You

Steven Schveighoffer via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Jun 3 04:25:33 PDT 2016


On 6/2/16 5:33 PM, Andrei Alexandrescu wrote:
> 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.
>
> 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?

I think it depends on what your browser presents. But impossible to tell 
without being on the OP's machine to see what it's actually stored as. 
Thunderbird may have normalized as well!

-Steve


More information about the Digitalmars-d-announce mailing list