Today's programming challenge - How's your Range-Fu ?

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 18 04:35:46 PDT 2015


On 2015-04-18 12:27, Walter Bright wrote:

> That doesn't make sense to me, because the umlauts and the accented e
> all have Unicode code point assignments.

This code snippet demonstrates the problem:

import std.stdio;

void main ()
{
     dstring a = "e\u0301";
     dstring b = "é";
     assert(a != b);
     assert(a.length == 2);
     assert(b.length == 1);
     writefln(a, " ", b);
}

If you run the above code all asserts should pass. If your system 
correctly supports Unicode (works on OS X 10.10) the two printed 
characters should look exactly the same.

\u0301 is the "combining acute accent" [1].

[1] http://www.fileformat.info/info/unicode/char/0301/index.htm

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list