Closed goodmorningbob closed 9 years ago
Hi,
When including Emoji's in the tweet text the st_numberOfCharactersInATweet method is counting these as 2 characters while Twitter accepts them as 1 character.
As a temporary fix i have modified -
as follows -
// NSInteger count = [s length]; __block NSInteger count = 0; [s enumerateSubstringsInRange:NSMakeRange(0, s.length) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString subString, NSRange subStringRange, NSRange enclosingRange, BOOL stop) { count++; }];
This seems to give a correct count for Twitter but would be interested to get your take on this as I am not overly familiar with the Twitter API.
Thanks.
/jh
You are perfectly right, thank you for spotting this error.
Hi,
When including Emoji's in the tweet text the st_numberOfCharactersInATweet method is counting these as 2 characters while Twitter accepts them as 1 character.
As a temporary fix i have modified -
as follows -
// NSInteger count = [s length]; __block NSInteger count = 0; [s enumerateSubstringsInRange:NSMakeRange(0, s.length) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString subString, NSRange subStringRange, NSRange enclosingRange, BOOL stop) { count++; }];
This seems to give a correct count for Twitter but would be interested to get your take on this as I am not overly familiar with the Twitter API.
Thanks.
/jh