The string type is broken
mortoray.com
The string type is broken
1–10 of 230 posts
Re: The string type is broken
#2Is the "ffl-ligature to uppercase" test really relevant? Isn't that fixed by appropriate use of string normalisation?
Re: The string type is broken
#3Hat tip to Guido van Rossum for passing (nearly) all the tests in Python 3. Is the "ffl-ligature to uppercase" test really relevant? Isn't that fixed by appropriate use of string normalisation?
[originally i had a post here saying i couldn't get the noel to work on 3.3.2]
Re: The string type is broken
#4Edit: sadly, it doesn't.
Re: The string type is broken
#5Hat tip to Guido van Rossum for passing (nearly) all the tests in Python 3. Is the "ffl-ligature to uppercase" test really relevant? Isn't that fixed by appropriate use of string normalisation?
Not all languages (or even characters) have a well-defined upper-case versions of their glyphs.
Even if they all did, I would expect the interpretation by a (human) reader to vary culturally.
Re: The string type is broken
#6You can use UnicodeUtils if you need "full" Unicode support:
>> UnicodeUtils.upcase("baffle")
=> "BAFFLE"
>> graphemes = UnicodeUtils.each_grapheme("noe\u0308l").to_a
>> graphemes.reverse.join
=> "lëon"
>> graphemes.size
=> 4
>> graphemes[0, 3]
=> "noë"Re: The string type is broken
#7Happy to see that ruby (2.0 at least) passes all the tests except the "baffle" one. Edit: sadly, it doesn't.
"noe\u0308l".size # => 5
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0]Re: The string type is broken
#8Hat tip to Guido van Rossum for passing (nearly) all the tests in Python 3. Is the "ffl-ligature to uppercase" test really relevant? Isn't that fixed by appropriate use of string normalisation?
I also doubt the validity of the upper-casing, it feels like in an internationalization/localization context, converting a string to all upper case is not a valid thing to be doing. Not all languages (or even characters) have a well-defined upper-case versions of their glyphs. Even if they all did, I would expect the interpretation by a (human) reader to vary culturally.
EDIT: And yes, different languages can have different uppercasing rules. There's still a standard: https://github.com/lang/unicode_utils/blob/master/data/CaseF...
Re: The string type is broken
#9Re: The string type is broken
#10Hat tip to Guido van Rossum for passing (nearly) all the tests in Python 3. Is the "ffl-ligature to uppercase" test really relevant? Isn't that fixed by appropriate use of string normalisation?
I also doubt the validity of the upper-casing, it feels like in an internationalization/localization context, converting a string to all upper case is not a valid thing to be doing. Not all languages (or even characters) have a well-defined upper-case versions of their glyphs. Even if they all did, I would expect the interpretation by a (human) reader to vary culturally.
If there's only one way of expressing the thing - i.e. a single chinese character - then it would be valid to do nothing. It's just in english "y" and "Y" might change context, but as far as computer input is generally concerned they are the same thing.