Fixed url-encoding and converting to absolute URLs for entry URLs.

Note that we do a to_str of the URL before passing it to URI.encode. This is because of a regression in Rails in which sometimes passing certain strings to URI.encode causes this error:

  "undefined method `each_byte' for nil:NilClass"

However it seems invoking to_str just before passing the string to URI.encode seems to be a workaround. Something related with the handling rails is doing of html-safe strings, according to some github and stackoverflow comments. I haven't investigated a lot, but the workaround works for now.