Print Page | Close Window

Fix for RSS feeds & ISO-8859-1 encoding

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=24226
Printed Date: 06 April 2026 at 10:58pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Fix for RSS feeds & ISO-8859-1 encoding
Posted By: Edy
Subject: Fix for RSS feeds & ISO-8859-1 encoding
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net