Hacker News new | ask | show | jobs
by _mitterpach 477 days ago
That's a very nice and polished site, I especially like the sidebar for reading and speaking time, that seems very useful. I notice emojis count as two characters, but that's probably the standard, right?

I think there is a large market for apps that just work, they do one thing and one thing well. I remember reading about somebody who makes a living out of their app, which is just a crossword maker, but accessible enough to be used by teachers and ordinary people.

2 comments

It's not counting "characters"; it's counting UTF-16 code units, so for instance a country flag is 4 "characters" because it's two regional indicator symbols, each composed of two surrogates.

It should really be using `Intl.Segmenter` instead of `string.length`: https://stackoverflow.com/questions/10287887/get-grapheme-ch...

I mean, if this uses the same calculation as Twitter, Instagram and other sites that limit characters, then it should probably stay as it is, I don't have a problem with that.

However, a quirk in the way Unicode handles emoji has meant that some of the symbols take up many more characters than others. For example, a flag can take up as many as 14 spaces in your Tweet. Twitter has announced that it's changing the way it counts emoji so that they're all counted equally, as two characters. - https://www.theverge.com/2018/10/11/17963230/twitter-emoji-c...

So 4 character flag, which is written as 1 character, is sometimes counted as 2 characters. Honestly, I don't know, I did not expect for this to go so deep.

> I mean, if this uses the same calculation as Twitter, Instagram and other sites that limit characters

Almost certainly those sites use much more sophisticated counting schemes.

> Honestly, I don't know, I did not expect for this to go so deep

You're not the creator of the tool in question, so it's OK for you not to know about this stuff, but I would really expect more from someone who is setting out to create a "character counter" tool.

Some emojis require two UTF-16 code units so yep, standard

Thanks btw, I made this one as a test to see how it could perform as I can't stand terrible UI ones. I'll probably launch more. What'd you like to see next ?

> Some emojis require two UTF-16 code units so yep, standard

But not acceptable in a "character counter", in my opinion. What exactly is the use case for this counter, since it won't align with anyone's real-world intuition for the meaning of "character"?

You're actually right, I didn't think of this.

My counter is based on JS .length and can get up to 11 characters for specific emojis while X count all emojis as 2 characters.

Thanks for highlighting this