Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13650
Modified Files:
rss.php serendipity_functions.inc.php
Log Message:
made rss-feed compatible to utf8-sites
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.270
retrieving revision 1.271
diff -u -d -r1.270 -r1.271
--- serendipity_functions.inc.php 19 May 2004 16:07:11 -0000 1.270
+++ serendipity_functions.inc.php 24 May 2004 10:43:12 -0000 1.271
@@ -1494,6 +1494,14 @@
}
+function serendipity_utf8_encode($string) {
+ if (strtolower(LANG_CHARSET) != 'utf-8') {
+ return utf8_encode($string);
+ } else {
+ return $string;
+ }
+}
+
function serendipity_rss_getguid($entry, $comments = false) {
$guid = serendipity_archiveURL((isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']), $entry['title']);
if ($comments == true) {
@@ -1564,10 +1572,10 @@
/*********** ATOM 0.3 FEED *************/
?>
<entry>
- <link href="<?php echo $guid; ?>" rel="alternate" title="<?php echo utf8_encode(htmlspecialchars($entry['title'])); ?>" type="text/html" />
+ <link href="<?php echo $guid; ?>" rel="alternate" title="<?php echo serendipity_utf8_encode(htmlspecialchars($entry['title'])); ?>" type="text/html" />
<author>
- <name><?php echo utf8_encode(htmlspecialchars($entry['username'])); ?></name>
- <email><?php echo utf8_encode(htmlspecialchars($entry['email'])); ?></email>
+ <name><?php echo serendipity_utf8_encode(htmlspecialchars($entry['username'])); ?></name>
+ <email><?php echo serendipity_utf8_encode(htmlspecialchars($entry['email'])); ?></email>
</author>
<issued><?php echo gmdate('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></issued>
@@ -1585,11 +1593,11 @@
?>
<id><?php echo $guid; ?></id>
- <title mode="escaped" type="text/html"><?php echo utf8_encode(htmlspecialchars($entry['title'])); ?></title>
+ <title mode="escaped" type="text/html"><?php echo serendipity_utf8_encode(htmlspecialchars($entry['title'])); ?></title>
<content type="application/xhtml+xml" xml:base="<?php echo $serendipity['baseURL']; ?>">
<div xmlns="http://www.w3.org/1999/xhtml">
<?php
- echo utf8_encode($entry['body'].$ext);
+ echo serendipity_utf8_encode($entry['body'].$ext);
?>
</div>
</content>
@@ -1599,7 +1607,7 @@
/*********** BEGIN RSS 0.91/2.0 FEED *************/
?>
<item>
- <title><?php echo utf8_encode(htmlspecialchars($entry['title'])); ?></title>
+ <title><?php echo serendipity_utf8_encode(htmlspecialchars($entry['title'])); ?></title>
<link><?php echo $guid; ?></link>
<?php
/*********** END RSS 0.91/2.0 FEED *************/
@@ -1607,7 +1615,7 @@
if ($version == '2.0') {
/*********** RSS 2.0 FEED EXTRAS *************/
?>
- <category><?php echo utf8_encode(htmlspecialchars($entry['category_name'])); ?></category>
+ <category><?php echo serendipity_utf8_encode(htmlspecialchars($entry['category_name'])); ?></category>
<comments><?php echo $guid; ?></comments>
<wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo (isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']); ?></wfw:comment>
<?php
@@ -1618,10 +1626,10 @@
<?php
}
?>
- <author><?php echo utf8_encode(htmlspecialchars($entry['email'])) . ' (' . utf8_encode(htmlspecialchars($entry['username'])) . ')'; ?></author>
+ <author><?php echo serendipity_utf8_encode(htmlspecialchars($entry['email'])) . ' (' . serendipity_utf8_encode(htmlspecialchars($entry['username'])) . ')'; ?></author>
<content:encoded>
<?php
- echo utf8_encode(htmlspecialchars($entry['body'].$ext));
+ echo serendipity_utf8_encode(htmlspecialchars($entry['body'].$ext));
?>
</content:encoded>
<pubDate><?php echo date('r', $entry['timestamp']); ?></pubDate>
@@ -1638,7 +1646,7 @@
/*********** BEGIN RSS 0.91 FEED EXTRAS *************/
?>
<description>
- <?php echo utf8_encode(htmlspecialchars($entry['body'] . $ext)); ?>
+ <?php echo serendipity_utf8_encode(htmlspecialchars($entry['body'] . $ext)); ?>
</description>
</item>
<?php
@@ -1647,11 +1655,11 @@
} else if ($version == '1.0') {
?>
<item rdf:about="<?php echo $guid; ?>">
- <title><?php echo utf8_encode(htmlspecialchars($entry['title'])); ?></title>
+ <title><?php echo serendipity_utf8_encode(htmlspecialchars($entry['title'])); ?></title>
<link><?php echo $guid; ?></link>
<description>
<?php
- echo utf8_encode(htmlspecialchars($entry['body'].$ext));
+ echo serendipity_utf8_encode(htmlspecialchars($entry['body'].$ext));
?>
</description>
<?php
@@ -1659,9 +1667,9 @@
serendipity_plugin_api::hook_event('frontend_display:rss-1.0:per_entry', $eventData);
echo $eventData['display_dat'];
?>
- <dc:publisher><?php echo utf8_encode(htmlspecialchars($serendipity['blogTitle'])); ?></dc:publisher>
- <dc:creator><?php echo utf8_encode(htmlspecialchars($entry['email'])) . ' (' . utf8_encode(htmlspecialchars($entry['username'])) . ')'; ?></dc:creator>
- <dc:subject><?php echo utf8_encode(htmlspecialchars($entry['category_name'])); ?></dc:subject>
+ <dc:publisher><?php echo serendipity_utf8_encode(htmlspecialchars($serendipity['blogTitle'])); ?></dc:publisher>
+ <dc:creator><?php echo serendipity_utf8_encode(htmlspecialchars($entry['email'])) . ' (' . serendipity_utf8_encode(htmlspecialchars($entry['username'])) . ')'; ?></dc:creator>
+ <dc:subject><?php echo serendipity_utf8_encode(htmlspecialchars($entry['category_name'])); ?></dc:subject>
<dc:date><?php echo date('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></dc:date>
<wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo (isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']); ?></wfw:comment>
<?php
Index: rss.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/rss.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- rss.php 13 May 2004 13:10:51 -0000 1.25
+++ rss.php 24 May 2004 10:43:12 -0000 1.26
@@ -76,8 +76,8 @@
break;
}
-$title = utf8_encode($title);
-$description = utf8_encode($description);
+$title = serendipity_utf8_encode($title);
+$description = serendipity_utf8_encode($description);
include_once(S9Y_INCLUDE_PATH . 'serendipity_plugin_api.php');
$plugins = serendipity_plugin_api::enum_plugins();
|