Jump to content

German characters in RSS feeds


Timon

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?
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.