HN discards emojis in the title. The original emoji was https://emojipedia.org/man-facepalming-medium-light-skin-ton... which consists of 5 Unicode code points. Also please make sure to read the first heading after the title, which summarizes the whole point of this essay.
It’s not wrong that "🤦🏼♂️".length == 7 (2019)
11–20 of 315 posts
Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#12HN discards emojis in the title. The original emoji was https://emojipedia.org/man-facepalming-medium-light-skin-ton... which consists of 5 Unicode code points. Also please make sure to read the first heading after the title, which summarizes the whole point of this essay.
Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#13(2019), for what it's worth.
Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#14HN discards emojis in the title. The original emoji was https://emojipedia.org/man-facepalming-medium-light-skin-ton... which consists of 5 Unicode code points. Also please make sure to read the first heading after the title, which summarizes the whole point of this essay.
That makes more sense. I'm sure there could be some language out there where a empty strings length could be 7.
Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#15Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#16If you want to do Unicode string manipulation and length counting, then use specific functions for that - but the base internal .length function should just output bytes.
Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#17Python 3's approach is the most correct: Unicode defines text as a sequence of code points. UTF-whatever is an implementation detail.
Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#18Python 3's approach is the most correct: Unicode defines text as a sequence of code points. UTF-whatever is an implementation detail.
Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#19HN discards emojis in the title. The original emoji was https://emojipedia.org/man-facepalming-medium-light-skin-ton... which consists of 5 Unicode code points. Also please make sure to read the first heading after the title, which summarizes the whole point of this essay.
Zero width joiner emoji sequences https://emojipedia.org/emoji-zwj-sequence/
Re: It’s not wrong that "🤦🏼♂️".length == 7 (2019)
#20> Python 3’s approach is unambiguously the worst one, though. Did I miss the part where he explains this take? It's made up of 5 valid unicode code units. For a language where you're not supposed to need to know the byte size semantics, the correct length should be 5. What am I missing? The close second being 17, because length in bytes. Is another fine way to represent this data, e.g. what a successful write of some…
I think he meant to bring out defensiveness with that quip. He never says that it's a big deal, just that it's the worst way to get the length of a string containing emoji, presumably of the mainstream languages.