Skip to content

Commit

Permalink
Added multibyte string support
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskonnertz committed Mar 28, 2016
1 parent 98d240c commit a2ebbd8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ChrisKonnertz/OpenGraph/OpenGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ public function description($description, $maxLength = 250)
$description = trim(strip_tags($description));
$description = preg_replace("/\r|\n/", '', $description);

$length = strlen($description);
$length = mb_strlen($description);

$description = substr($description, 0, $maxLength);
$description = mb_substr($description, 0, $maxLength);

if (strlen($description) < $length) {
if (mb_strlen($description) < $length) {
$description .= '...';
}

Expand Down

0 comments on commit a2ebbd8

Please sign in to comment.