Skip to content

Commit

Permalink
StandaloneLinkHandler.php: Use iconv for encoding conversion
Browse files Browse the repository at this point in the history
Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
  • Loading branch information
zhaofengli committed Apr 5, 2015
1 parent 29b8636 commit 3168e71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"php": ">=5.3.0",
"ext-curl": "*",
"ext-mbstring": "*",
"ext-iconv": "*",
"jeremykendall/php-domain-parser": "~1.3",
"masterminds/html5": "2.*",
"twig/twig": "~1.0"
Expand Down
5 changes: 4 additions & 1 deletion src/Reflinks/LinkHandlers/StandaloneLinkHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ public function getMetadata( $url, Metadata $baseMetadata = null ) {
$encoding = "UTF-8";
}
if ( $encoding != "UTF-8" ) {
$utf8Html = mb_convert_encoding( $response->html, "UTF-8", $encoding );
$utf8Html = iconv( $encoding, "UTF-8", $response->html );
if ( false === $utf8Html ) {
$utf8Html = $response->html;
}
} else {
$utf8Html = $response->html;
}
Expand Down

0 comments on commit 3168e71

Please sign in to comment.