crowdfavorite/wp-twitter-tools — pull request #14 by ruanyf (2012-10-19 11:10:27+00:00)
Title: change some string functions in aktt_tweet.php into their multi-byte character version

After upgrading to twitter tools 3.0, I found when creating a post from a tweet, the post content is always truncated in wrong position.

I did some investigations, and came to the conclusion it seems to be due to some ascii-only functions.

So I change the link_entities() into multi-byte character version:

1. the line

'''$str = substr_replace($str, $entity['replace'], $start, ($end - $start));
'''

into

'''$str = mb_substr_replace($str, $entity['replace'], $start, ($end - $start));
'''

2. the line

'''$diff += strlen($entity['replace']) - ($end - $start);
'''

into

'''$diff += mb_strlen($entity['replace']) - ($end - $start);
'''