News for hackers. Stuff that matters.
Re:The string type is broken (2013) by qw3rty01 on Tuesday June 22, 2021 @10:10PM (#27599987)
this isn't quite set up the way the article was mentioning. Here's with it set up correctly:

https://play.rust-lang.org/?version=stable&mode=debug&editio...

It looks like it still misses some of the cases (specifically with decomposed vs precomposed).

As a side note, it looks like the playground editor also doesn't correctly render some of the lengths (the cursor is 1 character off on the decomposed case)

Re:The string type is broken (2013) by brundolf on Tuesday June 22, 2021 @10:14PM (#27600015)
Huh, I'd never heard of decomposed/precomposed before and I kind of skimmed over them in the original article. Looking at your example, I still can't figure out what the difference is between the two (I guess the Playground editor itself just can't represent the difference?). I'll have to go read up on that concept.

Edit: Having read about them, I guess I assumed that if my keyboard inputs an ë it's actually inputting those two underlying characters. Or to put it differently, I assumed there weren't two separate representations for the same character; that the "decomposed" and "precomposed" versions are one in the same, at the byte level. Learned something h̶o̶r̶r̶i̶f̶y̶i̶n̶g̶ new!

Re:The string type is broken (2013) by qw3rty01 on Wednesday June 23, 2021 @09:28AM (#27604319)
After a little bit of research, it looks like this is how you would get the expected outputs: https://play.rust-lang.org/?version=stable&mode=debug&editio...