RSS Update ‘n Stuff

It took almost all day, but I’ve got all of my major sites with ongoing news set up with proper RSS feeds and I’ve fixed the bug that’s been bothering me for a long time now. When users have pre-written content in Word and they paste in into a textarea field on the web, the encoding is wrong so when they mash the save button, the quotes and apostrophes are placed in the document in their native format (like this: ’) instead of the normal ASCII where there’s only one character for the quotes. Once I finally had time to put my mind to it, the whole thing came together quite nicely. I found all of the character codes for the characters which appear as question marks in Firefox and Chrome and blocks in Internet Explorer then I just used PHP’s str_replace to replace them all in the strings that come out of the database.

<?php

$msfind = array(chr(150),

chr(146),

chr(145),

chr(147),

chr(148),

chr(151),

chr(133),

chr(149), # bullet

);

$msreplace = array(“-“,

“‘”,

“‘”,

“””,

“””,

“-“,

“…”,

“-“,

);     

print(str_replace($msfind,

                    $msreplace,

                    $textfromdatabase));

?>

So once that was all pretty, I made the RSS hints on the headers of my main pages so that people can subscribe to those feeds (and actually know where they are).


Finished!For those of you who are keeping score at home, by the way, my marathon finishing time was 4 hours 10 minutes and 2 seconds (chip time). It actually took me 5 minutes from the time the gun went off to get over the start line, which is why the photo shows me at gun time. The day was warm and for my first marathon, I’m really quite happy with my time because all things considered, I did a good job and I’ve left myself room for improvement. If the weather was like the last couple of days, heat wouldn’t have been an issue, but that’s how life works right?

We’re having a wrap-up meeting at the Fat Duck to celebrate our first marathon tomorrow, so I’m looking forward to that. Then in a week, my lovely wife and I off to Italy for 10 days!

Author: Ian

Share This Post On

Submit a Comment

Your email address will not be published.