dropplets icon indicating copy to clipboard operation
dropplets copied to clipboard

Strange characters in RSS feed <title>

Open peterrovid opened this issue 13 years ago • 11 comments

I've got problem with characters in my RSS feed. It seems this is an everyday problem who uses strange characters like me (őúáűóüí). The problem is only visible in the title it the RSS feed. The description and the content is perfect. I already made a change in the feedwriter.php, added "application/rss+xml; charset=utf-8" to the header line around the 88th line in the php instead of content-type: text/html. It doesn't helped. It is very interesting that only the title is wrong...

peterrovid avatar Sep 19 '13 19:09 peterrovid

Could you send me the URL of your RSS feed please?

lfuelling avatar Sep 20 '13 07:09 lfuelling

Hi.

peterrovid.com/rss

peterrovid avatar Sep 20 '13 07:09 peterrovid

Okay, Thanks.

Let's take a look at your second post:

<title>Visszak&Atilde;&copy;zb&Aring;�l legyint az UniCredit</title>

It seems that the feedwriter-script (or the markdown converter) is converting the "strange characters" into HTML characters. According to w3schools those are part of the ISO-8859-1 charset. Try to change the charset from UTF-8 to ISO-8859-1. That should work.

lfuelling avatar Sep 20 '13 07:09 lfuelling

~~Should work for the most characters. However there is no definition for the ő character in this charset...~~

Well there is. But it seems that the Markdown-converter isn't converting this and propably a few other characters. Source

lfuelling avatar Sep 20 '13 07:09 lfuelling

Hello. I tried, and set the charset to iso-8859-1. Nothing happened.

I think you have right regarding the markdown converter. But I can not find out how can I fix this. Maybe a converter itself needs iso-8859? Or should I somehow insert feed_variable to the converter manually for my own strange characters?

peterrovid avatar Sep 20 '13 08:09 peterrovid

I think the converter just needs to have all those characters ant their HTML-Code implemented.

lfuelling avatar Sep 20 '13 08:09 lfuelling

I found an article (http://michelf.ca/blog/2005/php-markdown-text-encoding/). I know it is old, but it says Markdown is not altering anything, simply adds every character as is.

I found something out yesterday. I simply erased 'title' from

public function setTitle($title)
    {
        $this->setChannelElement('title', $title);
    }

The result was interesting. Instead of this:

<title>Visszak&Atilde;&copy;zb&Aring;‘l legyint az UniCredit</title>

I get this (with good characters):

<Visszakézből legyint az UniCredit></Visszakézből legyint az UniCredit>

I know there is no title tag, and even not worked well, but it made me angry, that this time the characters were good...

peterrovid avatar Sep 20 '13 09:09 peterrovid

Okay, that's strange. I will take a look at this, when I'm at home and see what I can do.

lfuelling avatar Sep 21 '13 15:09 lfuelling

Okay, I did a bit research and found some interesting posts in other forums. One is the most interesting for me. They said we should add a forced conversion to the charset like this: utf8_encode(htmlentities($source,ENT_COMPAT,'utf-8')) where source is title in our case. It seems the code is not wrong (my website works, and the rss feed seems also working, but the titles are still wrong....... I really don't know what can be the problem with this feedwriter plugin...

peterrovid avatar Sep 23 '13 19:09 peterrovid

I just looked around the markdown.php file, and there are so many encodeAttribute's to title tags that I didn't wonder if some of them is making the troubles for us...

peterrovid avatar Sep 23 '13 19:09 peterrovid

To be honest I don't have any idea what's the problem there at the moment. On my website (k40s.net) there is sometimes a complete feed shown, sometimes it contains only one post, and sometimes it is empty.

I'm now starting think the error here is in the feedwriter.php (or any related file) because on the webpage the chars are all right.

Have you tried opening the feed with a reader? Like Feedly/Google Reader?

lfuelling avatar Sep 24 '13 21:09 lfuelling