com web/news: Add a default charset to all format helpers: common.php
| From: | Ben Ramsey | Date: | Fri, 21 Jul 2017 23:42:02 +0000 |
| Subject: | com web/news: Add a default charset to all format helpers: common.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26184@lists.php.net to get a copy of this message | ||
Commit: 6035f03304a93b5b25d56687a19f00abc1072c58
Author: Arnaud Lemercier <arnaud@wixiweb.fr> Sat, 22 Jul 2017 01:42:02 +0200
Parents: 95195cb9cc0cb63b23115f229d77bbdf8dc880d5
Branches: master
Link: http://git.php.net/?p=web/news.git;a=commitdiff;h=6035f03304a93b5b25d56687a19f00abc1072c58
Log:
Add a default charset to all format helpers
Changed paths:
M common.php
Diff:
diff --git a/common.php b/common.php
index e4c3090..e81fa3e 100644
--- a/common.php
+++ b/common.php
@@ -111,7 +111,7 @@ function spam_protect($txt) {
# this turns some common forms of email addresses into mailto: links
-function format_author($a, $charset) {
+function format_author($a, $charset = 'iso-8859-1') {
$a = recode_header($a, $charset);
if (preg_match("/^\s*(.+)\s+\\(\"?(.+?)\"?\\)\s*$/",$a,$ar)) {
return "<a href=\"mailto:".htmlspecialchars(urlencode(spam_protect($ar[1])),
ENT_QUOTES, "UTF-8")."\" class=\"email fn
n\">".str_replace(" ", " ", htmlspecialchars($ar[2],
ENT_QUOTES, "UTF-8"))."</a>";
@@ -126,7 +126,7 @@ function format_author($a, $charset) {
return str_replace(" ", " ", htmlspecialchars($a, ENT_QUOTES,
"UTF-8"));
}
-function format_subject($s, $charset) {
+function format_subject($s, $charset = 'iso-8859-1') {
global $article;
$s = recode_header($s, $charset);
@@ -146,7 +146,7 @@ function format_subject($s, $charset) {
}
-function format_title($s, $charset) {
+function format_title($s, $charset = 'iso-8859-1') {
global $article;
$s = recode_header($s, $charset);
$s = preg_replace("/^(Re: *)?\[(PHP|PEAR)(-.*)?\] /i", "\\1", $s);