Re: RSS Feed Accented Characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




-----Original Message----- From: Richard Quadling
Sent: Friday, September 30, 2011 12:31 PM
To: Ron Piggott
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  RSS Feed Accented Characters

On 30 September 2011 17:26, Ron Piggott <ron.php@xxxxxxxxxxxxxxxxxx> wrote:

I am trying to set up an RSS Feed in the Spanish language using a PHP cron job. I am unsure of how to deal with accented letters.

An example:

This syntax:

<?php

$rss_content .= "<description>" . htmlentities("El Versículo del Día") . "</description>\r\n";

?>

Outputs:


<description>El Vers&iacute;culo del D&iacute;a</description>


When I use an RSS Feed validator I receive the error message

This feed does not validate.

a.. line 24, column 20: XML parsing error: <unknown>:24:20: undefined entity

I suspect the “;” is the issue, although it is needed for the accented letters. If I don’t use htmlentities() the accented characters can’t be viewed, they become a “?” How should I proceed?

Ron

Make sure you have ...

<?xml version="1.0" encode="UTF-8"?>

as the first line of the output. That tells the reader that the file
is a UTF-8 encoded file. Also, if you ejecting HTTP headers, make sure
that they say the encoding is UTF-8 and not a codepage.

Go UTF-8 everywhere.


--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea




Hi Richard:

Having " <?xml version="1.0" encoding="UTF-8"?> " as the starting line didn't correct the problem.

The RSS Feed is @
http://www.elversiculodeldia.info/peticiones-de-rezo-rss.xml

There are a variety of errors related to accented characters while using a feed valuator
http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.elversiculodeldia.info%2Fpeticiones-de-rezo-rss.xml

- Also While viewing the feed in Firefox once the first accented character is displayed none of the rest of the feed is visible, except by right clicking and "view source"

The RSS Feed content will be populated by a database query. The database columns are set to utf8_unicode_ci

How should I proceed?
Ron

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux