diff --git a/include/items.php b/include/items.php
index ec519ad9bf..39a61c4ad0 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1635,7 +1635,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
$o .= '' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '' . "\r\n";
$o .= '' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '' . "\r\n";
$o .= '' . base64url_encode($body, true) . '' . "\r\n";
- $o .= '' . xmlify(($type === 'html') ? bbcode($body) : $body) . '' . "\r\n";
+ $o .= '' . xmlify((($type === 'html') ? bbcode($body) : $body)) . '' . "\r\n";
$o .= '' . "\r\n";
if($comment)
$o .= '' . intval($item['last-child']) . '' . "\r\n";
diff --git a/include/text.php b/include/text.php
index 803bf0e510..b13cf980f2 100644
--- a/include/text.php
+++ b/include/text.php
@@ -147,7 +147,7 @@ if(! function_exists('xmlify')) {
function xmlify($str) {
$buffer = '';
- for($x = 0; $x < strlen($str); $x ++) {
+ for($x = 0; $x < mb_strlen($str); $x ++) {
$char = $str[$x];
switch( $char ) {