Posting code: the secretTuesday, March 08, 2005
OK. I've got it figured out from too much time spent trying to get the code in my last post to display properly. It's not only those blasted "less than" and "greater than" symbols, but also the ampersand.
So, a note while it's fresh - both for me and in case it may help anyone else.
1. Replace all the "&" with "&# 38;" (without the space) (or with "&")
2. Replace all the "<" with "<"
3. Replace all the ">" with ">"
(I'm getting the sequence at the end of no. 1 to display properly by actually typing in this sequence into my post (without the spaces): "& amp; 38;")
The order is important - replace any "&" in the code FIRST (i.e. do step no. 1 first) otherwise you could inadvertently replace the "&" that you need as part of the "<" and ">" replacements.
I do that in Word, with a macro I've now whipped up. Then, just to get rid of any horrid hidden codes or changes introduced by Word (it does terrible things to double quotation marks), I copy/paste the changed code into Notepad. Then I copy/paste from Notepad to my post. (Yes, I know I need to get a proper text editor!).
Conversion tool[Added 21 May 2005:] Found a site that provides an automatic converter, yay: Centricle.
You just copy/paste your code into the first box and hit "Encode" and it does a search and replace for you automatically of the tricky characters you have to encode in order for code to show up properly. Just copy the code from the box for pasting into your post or webpage. It also converts the other way round - i.e. it decodes as well as encodes.
Now if only I can get long code to wrap in my posts without mucking up its workings... ([added 21 May 2005:] which I now can thanks to redryder52, another yay!)
Technorati Tags: HTML, escape characters, code, Webpages, Websites, blogs, blogging, Improbulus, A Consuming Experience, Consuming Experience