|
|
@@ -102,16 +102,21 @@ function safe_ascii($text) {
|
|
|
return filter_var($text, FILTER_DEFAULT, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH);
|
|
|
}
|
|
|
|
|
|
-function escapeToUnicodeAlternative($text) {
|
|
|
+function escapeToUnicodeAlternative($text, $extended = true) {
|
|
|
$text = htmlspecialchars_decode($text, ENT_QUOTES);
|
|
|
+
|
|
|
+ //Problematic characters
|
|
|
+ $problem = array('&', '<', '>');
|
|
|
+ //Use their fullwidth Unicode form instead:
|
|
|
+ $replace = array('&', '<', '>');
|
|
|
+
|
|
|
// https://raw.githubusercontent.com/mihaip/google-reader-api/master/wiki/StreamId.wiki
|
|
|
- return trim(str_replace(
|
|
|
- //Problematic characters
|
|
|
- array("'", '"', '^', '<', '>', '?', '&', '\\', '/', ',', ';'),
|
|
|
- //Use their fullwidth Unicode form instead:
|
|
|
- array("’", '"', '^', '<', '>', '?', '&', '\', '/', ',', ';'),
|
|
|
- $text
|
|
|
- ));
|
|
|
+ if ($extended) {
|
|
|
+ $problem += array("'", '"', '^', '?', '\\', '/', ',', ';');
|
|
|
+ $replace += array("’", '"', '^', '?', '\', '/', ',', ';');
|
|
|
+ }
|
|
|
+
|
|
|
+ return trim(str_replace($problem, $replace, $text));
|
|
|
}
|
|
|
|
|
|
/**
|