Skip to content

Recent Twitter char counting changes 😭 #8

Closed

Description

@snarfed

evidently, along with the recent switch to 280 chars, twitter also changed the way they count chars. (IRC discussion.) it's no longer simply unicode code points, it's some weighted thing i don't understand yet. one big effect is that emoji seem to now count for two chars, not one.

this made e.g. @tantek's recent bridgy publish attempt fail. we tried to publish this content:

This is meditation. #FBF to last Saturday, in the zone, racing the Mt. Tam Trail Run half marathon with singular focus. 📷 chasquirunner.com

Awake the night before @TheNorthFace #ECSCA, thinking back to last Saturday’s challenges and triumphs, this… 

http://tantek.com/2017/321/t2/last-saturday-racing-tam-half-marathon

which twitter 403ed it with "Tweet needs to be a bit shorter."

if you count chars normally, it's 319 total, - 17 + 23 for chasquirunner.com, - 68 + 23 for the permalink, == 280.

however, if you paste it into the twitter UI, that says it's 3 chars over. deleting the camera and ellipsis emoji each drop it by 2. i haven't found the last extra char yet.

goddammit.

Activity

  1. snarfed commented on Nov 18, 2017

    @snarfed
    CollaboratorAuthor

    ok, after reading the docs, i understand the new way. some chars (code points) now count for two instead of one, and they have a data driven config that determines which are which. it'll take a little work to implement, but not a ton. seems doable.

    https://developer.twitter.com/en/docs/developer-utilities/twitter-text

  2. snarfed commented on Nov 24, 2017

    @snarfed
    CollaboratorAuthor

    reopening, this is still buggy. :/

    added a failing test case in karadaisy/brevity-testcases#3. the problem is that the new str_length() returns weighted count, but we also use it to index into the python string, which we shouldn't. those are separate measurements that can't be mixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions