htmlspecialchars utf-8 liefert leeren string

Mache ich eine .php-RSS-generator und ich habe ein problem, zu versuchen, um Daten aus meiner Datenbank in dieser Zeile:

<description><![CDATA[<?=htmlspecialchars(utf8_substr($row['texto'], 0, 100), ENT_QUOTES, 'utf-8') ?>...]]></description>

Einige Einträge, die zeigen ganz gut, und andere, die nicht der RÜCKFÜHRUNG text... keine Ahnung, auf was falsch sein könnte?

Dies ist der gesamte code:

<?php

require('php/config.php');
require('php/db.php');
require('php/utils.php');

header("Content-type: application/xml");

$db = new TSQL('SELECT * FROM entradas WHERE estado = 1 ORDER BY fecha DESC LIMIT 20');
if ( $db->executeQuery() ) {

?><?='<?xml version="1.0" encoding="utf-8" ?>' ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Tu Secreto</title>
        <link>http://www.tusecreto.com.ar/</link>
        <description>TuSecreto /No se lo cuentes a nadie, contaselo a todos</description>
        <language>es-ar</language>
        <copyright>TuSecreto (C) 2005-<?php print strftime("%Y", time()); ?></copyright>
        <lastBuildDate><?=strftime("%a, %d %b %Y %H:%M:%S ", $row['fecha']) ?></lastBuildDate>
        <atom:link href="http://www.tusecreto.com.ar/rss.php" rel="self" type="application/rss+xml" />
        <docs>http://www.tusecreto.com.ar/rss.php</docs>
        <generator>TuSecreto RSS Generator v1.0</generator>
        <ttl>10</ttl>
        <? while ($row = $db->getRow(MYSQL_ASSOC)) { ?>
        <item>
            <title><?=($row['sexo'] == MUJER)?'Mujer':'Hombre' ?> | <?=$row['edad'] ?> <?="A\xC3\xB1os" ?></title>
            <description><![CDATA[<?=htmlspecialchars(utf8_substr($row['texto'], 0, 100), ENT_QUOTES, 'utf-8') ?>...]]></description>
            <link>http://www.tusecreto.com.ar/<?=$row['id'] ?></link>
            <guid isPermaLink="true">http://www.tusecreto.com.ar/<?=$row['id'] ?></guid>
            <pubDate><?=strftime("%a, %d %b %Y %H:%M:%S ", $row['fecha']) ?></pubDate>
        </item>
        <?php } ?>
    </channel>
</rss>

Dies ist ein Ergebnis, dass einen leeren string zurück:

una vez en el colectivo (sentada en el asiento einzelnen) mir dormí y cuando doblo me caí de el pasillo wieder mal! se mataron de la risa todos!! hasta el colectivero! Pasalo y con comento mi Facebook. E. P.

  • Geben Sie ein Beispiel von einigen, die sich in die Rückgabe ein leerer string.
  • Wie ist utf8_substr definiert?
  • Ich habe aktualisiert die post mit allen Codes und ein Ergebnis... Vielleicht ist es, weil die akzentuierten Zeichen? "dormí". Ist Spanisch...
InformationsquelleAutor Santiago | 2012-06-18
Schreibe einen Kommentar