diff --git a/README.md b/README.md index 834bb69..c20ed0a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ to post it on Twitter. - PHP 5.3 - PHP cURL extension + - PHP mbstring extension - Shaarli >= v0.8.1 ## Installation diff --git a/shaarli2twitter/shaarli2twitter.php b/shaarli2twitter/shaarli2twitter.php index beedf37..b527285 100644 --- a/shaarli2twitter/shaarli2twitter.php +++ b/shaarli2twitter/shaarli2twitter.php @@ -206,7 +206,7 @@ function replace_placeholder($tweet, $placeholder, $value) // Tweets URL have a fixed size due to t.co $valueLength = ($placeholder != 'url' && $placeholder != 'permalink') ? strlen($value) : TWEET_URL_LENGTH; if ($current + $valueLength > TWEET_LENGTH) { - $value = substr($value, 0, TWEET_LENGTH - $current - 3) . '…'; + $value = mb_strcut($value, 0, TWEET_LENGTH - $current - 3) . '…'; } return str_replace('${'. $placeholder .'}', $value, $tweet); }