https://issues.dlang.org/show_bug.cgi?id=16210
--- Comment #2 from Jack Stouffer <[email protected]> --- (In reply to Jakub Łabaj from comment #1) > Assuming "ö" == [0xC3, 0xB6], which one version would be correct: > a) behaviour of std.utf.byCodeUnit, just go by code units backward: > "ö".byUTF!char().back == 0xB6 > > b) decode the character and return its first code unit: > "ö".byUTF!char().back == 0xC3 > > Personally I thought the b) version is desired (docs says that byUTF encodes > input), but at the moment it passes some inputs to byCodeUnit - it means for > some ranges byUTF is bidirectional already and version a) applies. Well damn. IMO B is more intuitive in all situations, so byUTF returning by byCodeUnit isn't want we really want. But because we can't break code, we would have to have B be the behavior only when some encoding has to be done inside of byUTF and clearly document this odd behavior. --
