Jump to content

Archived

This topic is now archived and is closed to further replies.

Timon

German characters in RSS feeds

Recommended Posts

I'm building a site which displays some rss feeds to visitors. Because our target audience contains people from different coutries, we try to keep it a bit international by providing feeds in Dutch, German and English. The Dutch and English feeds go well so far, but when a german feed contains german characters, they won't be displayed correctly (for example, ß becomes ß ). The code I use can be found here:

[a href=\"http://pastebin.com/694184\" target=\"_blank\"]http://pastebin.com/694184[/a]

(i've tried pasting the code in and putting code tags around it, but then it wouldn't let me post my message)
I've already tried without the htmlentities/striptags/html_entity_decode lines (line 103/104), this does not work. Could it be because the results are being cached in a file, that during file I/O characters get converted?

Share this post


Link to post
Share on other sites
I've figured it out for myself already, I'll post the solution here so that anyone else having the same problem may learn from it:

The problem was that the rss feed was encoded in the UTF-8 character set (newsfeeds usually are). The character set which I use for the site is ISO-8859-1. To convert a string from UTF-8 to ISO-8859-1, the iconv statement can be used. In my case, all I had to do was insert:

[code]$feed_input = iconv("UTF-8", "ISO-8859-1", $feed_input);[/code]

after reading the feed contents and before replacing any special characters with html entities.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.