When I got home I downloaded the pics I had taken to my comp, and then had lunch.
After lunch I played on Animal Crossing. It was raining, and then it started thundering. I couldn't see any lightning forks in the sky, but the ground lit up when it did lightning. It was quite good, because when you're in a building, the lightning flashes light up the windows. Also, I dug 6 gyroids and a fossil. Makes a big change to the past week or two when there haven't been any fossils most days, and just a pitfall each day.
I did some work on my photo website, changing the urls to be shorter, so rather than using the path to the category/image as part of the url, it now just contains the category name/image name.
Then I decided that it would be a good idea to store the url version of the category name in the database, so I didn't need to keep converting the category name to url format every time I needed. But before I could do that, I needed to decide what format my urls should be in.
I decided that I wanted spaces converted into hyphens, but what other characters, such as '?', and '&'? Question mark needs encoding as otherwise it means the start of a query string. And ampersand and friends need encoding as they're valid text in XML, so any links with an unencoded & would break the page.
I tried using
urlencode()
, which converts, the ? and & characters to hex values, but also converts any other non alphanumeric characters (except -_.) to hex values as well. So this can result in messy looking urls when using non alpha-numeric characters, and I don't know how Google treats url encoded characters.Eventually after some testing and googling I settled on using
htmlspecialchars()
to encode ", <, >, and & characters, and manually urlencoding ? by using str_replace. I also found that I could set accept-charset="UTF-8"
on the <form>
element, and that htmlspecialchars()
uses the ISO-8859-1 character set by default, so you need to tell it to use UTF-8.Later in the evening I found that I couldn't view source in Internet Explorer, I just got a message saying "The XML source file is unavailable for viewing". Doing some googling I found session_start causes "The XML source file is unavailable for viewing" on IE, which says it's a problem with the cache headers, and Debugging the Internet Explorer View Source problem with Fiddler and fixing ASP.NET, which again points to the cache headers. Following the debugging procedure suggested in that second link, I deleted the cache headers that IE was receiving for the page, and then I could view source.
I haven't actually changed the cache headers being sent by the server yet, that's something for me to do later.
Food
Breakfast: Chocolate crunch oat cereal; cup o' tea.
Lunch: Ham with mustard and sweet & crunchy salad sandwich; satsuma; slice of madeira cake; Rocky; cup o' tea.
Afternoon snack: Lidl Cornetto; cup o' tea.
Dinner: Slice of Mozzarella pizza; slice of Spinach pizza; chips; peas; salt. Pudding was a Black cherry and chocolate Muller fruit corner. Coffee; 3 pieces of Sainsbury's caramel chocolate.
Supper: Milk chocolate digestive; malted milk; cup o' tea.
No comments:
Post a Comment