module Wordpress::WXR::Attachment::Refinements

Internal: Add methods to normalize potential utf-8 encodings into standard ASCII escaping to feed into URI which dies on utf-8 characters.

Public Instance Methods

percent_encode_non_ascii() click to toggle source
# File lib/wordpress/wxr/attachment.rb, line 16
def percent_encode_non_ascii
  encode(Encoding.find('ASCII'), invalid: :replace, fallback: ->(char) { CGI.escape(char) })
end
replace_spaces_with_hex_encoding() click to toggle source
# File lib/wordpress/wxr/attachment.rb, line 12
def replace_spaces_with_hex_encoding
  gsub(/\s/, '%20')
end