Jump to content


Photo

German characters in RSS feeds


  • Please log in to reply
1 reply to this topic

#1 Timon

Timon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 02 May 2006 - 02:43 PM

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?

#2 Timon

Timon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 May 2006 - 02:49 PM

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:

$feed_input = iconv("UTF-8", "ISO-8859-1", $feed_input);

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users