Skip to content

Commit

Permalink
fix usages of iconv
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed Nov 8, 2017
1 parent d1c7b27 commit 70d15cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libs/Format/HTML/ContentTypes/Markdown/TOC/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function escaped($url) {
$url = trim($url);
$url = preg_replace('~[^\\pL0-9_]+~u', '-', $url);
$url = trim($url, "-");
$url = iconv("utf-8", "us-ascii//TRANSLIT", $url);
$url = iconv("utf-8", "ASCII//TRANSLIT//IGNORE", $url);
$url = preg_replace('~[^-a-zA-Z0-9_]+~', '', $url);

return $url;
Expand Down
4 changes: 1 addition & 3 deletions libs/Format/HTML/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ private function sanitize($text)

// Sometimes strings are detected as invalid UTF-8 and json_encode can't treat them
// iconv can fix those strings
if (function_exists("iconv")) {
$text = iconv('UTF-8', 'UTF-8//IGNORE', $text);
}
$text = iconv('UTF-8', 'UTF-8//IGNORE', $text);

return $text;
}
Expand Down

0 comments on commit 70d15cc

Please sign in to comment.