posterous

What does “Liquid error: private method `gsub' called for nil:NilClass” mean on a posterous blog?

拜拜、爱过 提交于 2019-12-10 13:09:19
问题 I have faced an issue with this message on the right side of my blog. Could you please help me out? 回答1: I just ran into this error too. You're probably running a liquid filter on a value that is coming up nil. I had something like this on my jekyll site: <title>{{ page.title | xml_escape }}</title> And on my root page, the title was not set. You can fix it by making sure that the value is set, or you can hack around with with something like this to force the nil into a string: {{ page.title

Unescaping characters in a string with Ruby

孤者浪人 提交于 2019-12-01 09:13:20
Given a string in the following format (the Posterous API returns posts in this format): s="\\u003Cp\\u003E" How can I convert it to the actual ascii characters such that s="<p>" ? On OSX, I successfully used Iconv.iconv('ascii', 'java', s) but once deployed to Heroku, I receive an Iconv::IllegalSequence exception. I'm guessing that the system Heroku deploys to does't support the java encoder. I am using HTTParty to make a request to the Posterous API. If I use curl to make the same request then I do not get the double slashes. From HTTParty github page: Automatic parsing of JSON and XML into

Unescaping characters in a string with Ruby

青春壹個敷衍的年華 提交于 2019-12-01 06:17:16
问题 Given a string in the following format (the Posterous API returns posts in this format): s="\\u003Cp\\u003E" How can I convert it to the actual ascii characters such that s="<p>" ? On OSX, I successfully used Iconv.iconv('ascii', 'java', s) but once deployed to Heroku, I receive an Iconv::IllegalSequence exception. I'm guessing that the system Heroku deploys to does't support the java encoder. I am using HTTParty to make a request to the Posterous API. If I use curl to make the same request

Unescaping Characters in a String with Python

纵饮孤独 提交于 2019-12-01 02:05:10
问题 I made a JSON request that gives me a string that uses Unicode character codes that looks like: s = "\u003Cp\u003E" And I want to convert it to: s = "<p>" What's the best way to do this in Python? Note, this is the same question as this one, only in Python except Ruby. I am also using the Posterous API. 回答1: If the data came from JSON, the json module should already have decoded these escapes for you: >>> import json >>> json.loads('"\u003Cp\u003E"') u'<p>' 回答2: >>> "\\u003Cp\\u003E".decode(