This project is a fun time buster utilizing python to retrieve and parse out an ICS file for use in a larger project.
Topics covered so far in this exercise are importing and utilizing the requests module as well as breaking myself of the habit of using trailing semicolons!
One big issue I was running into: encoding. On my local python install / IDLE, the encoding was correct and all nonstandard English characters were showing up while printing in the console. To be completely honest I didn’t put much thought into encoding before but now after 3 days of reading, it’s finally starting to dawn on me! The secondary encoding issue I was encountering was on the server level, the encoding in my server’s shell was set some ANSI encoding and despite setting the encoding in the python file, I couldn’t get the server to use the proper encoding so when the script was run on the server, the console printed out a couple garbage characters!
Solution: editing my .bash_profile and .bashrc files to set the encoding worked a treat (but I’m still not entirely convinced this is the correct way despite being explicit in the file itself…).
My next task is to figure out how to get the characters to display correctly on the html file that I output, though after reading Joel Spolsky’s, “The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)“, it’s starting to make more sense and that the lack of encoding data in the head of my rendered html document probably has to do with it displaying weird in my browser!
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Edit: I was incorrect! My encoding was wrong but it was in ANSI not UTF-8. I’m still head scratching and need to do some more work on understanding coding better!. Changing the charset from utf-8 to ansi caused the special characters to render correctly in the HTML document.
Question marked as answered (for now)