I Don’t Get Text Encoding in Editorial/Python

Recorded on February 11th, 2016

For a week, I was using the Editorial FTP Upload workflow from Macdrifter, and then realized yesterday that the text encoding it was doing in this section was converting “>” characters to > entities.

encode_string = cgi.escape(postContent).encode('ascii', 'xmlcharrefreplace')

I think this is what messes up Markdown blockquotes when Statamic renders a page. It also prevents passing any HTML through Markdown, which you’re supposed to be able to do if you need to.

I tried a bunch of stuff, changing the encoding from xmlcharrefreplace to replace or ignore, but I had no idea what I was doing, and tampering with encoding when you don’t know Python seems like a bad idea. In the end, I switched to Gabe’s alternative SFTP Upload, since it accomplishes the same thing but doesn’t confuse Statamic with the encoding.

blog comments powered by Disqus