Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Fix for RSS feeds & ISO-8859-1 encoding
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Fix for RSS feeds & ISO-8859-1 encoding

 Post Reply Post Reply
Author
Edy View Drop Down
Newbie
Newbie


Joined: 20 August 2007
Location: Spain
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Edy Quote  Post ReplyReply Direct Link To This Post Topic: Fix for RSS feeds & ISO-8859-1 encoding
    Posted: 20 August 2007 at 6:19pm
Hello,

After upgrading my forum from V7 to V9 I noticed that the RSS feeds did strange things with the 8-bit ASCII characters (those with numeric value greater than 127). The forum encoding is configured as ISO-8859-1 and the main language is spanish. The most noticeable problem was that the tilded letters such "á" were replaced by their capital equivalent, "Á". For instance, if the following word appeared in a post:

    configuración

the RSS feed would show it this way:

    configuraciÓn

After examining the RSS generation code I found the way for fixing it. Open the file RSS_post_feed.asp and locate the following code at the line 340:

'Encode non ASCII characters that can crash RSS Feeds
For intRSSLoopCounter = 128 to 221
strSubject = Replace(strSubject, Chr(intRSSLoopCounter), "&#" & Trim(intRSSLoopCounter) & ";", 1, -1, 1)
strMessage = Replace(strMessage, Chr(intRSSLoopCounter), "&#" & Trim(intRSSLoopCounter) & ";", 1, -1, 1)
Next

Change the 221 to 255 and the last Replace function parameter from 1 to 0 in both lines:

'Encode non ASCII characters that can crash RSS Feeds
For intRSSLoopCounter = 128 to 255
strSubject = Replace(strSubject, Chr(intRSSLoopCounter), "&#" & Trim(intRSSLoopCounter) & ";", 1, -1, 0)
strMessage = Replace(strMessage, Chr(intRSSLoopCounter), "&#" & Trim(intRSSLoopCounter) & ";", 1, -1, 0)
Next

Repeat the same at the files RSS_topic_feed.asp and RSS_calendar_feed.asp.

I don't know why the authors just replaced the characters until Chr(221) instead of Chr(255). The lowercase tilded letters are beyond the value 221, at least in the encoding ISO-8859-1. As uppercase tilded letters are below 221 and the Replace mode was textual (original parameter 1) then the original code found the lowercase letters and replaced them with the uppercase equivalents.

My changes extend the scope of the replace loop to the full 8-Bit ASCII range, and also perform a binary comparison (Replace parameter 0). So the lowercase tilded letters are properly replaced with their XML-safe equivalents. This works just perfect for me.

Hope this make sense. Maybe it should be consideered for the next forum version.
Best regards,

Edy
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.