Use encode for xml_escape filter

This commit is contained in:
Pat Hawks 2016-03-21 11:07:46 -07:00
parent 2736be44c5
commit b06af5a44f
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
1 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ module Jekyll
# #
# Returns the escaped String. # Returns the escaped String.
def xml_escape(input) def xml_escape(input)
CGI.escapeHTML(input.to_s) input.to_s.encode(:xml => :attr).gsub(/\A"|"\Z/, "")
end end
# CGI escape a string for use in a URL. Replaces any special characters # CGI escape a string for use in a URL. Replaces any special characters
@ -308,7 +308,7 @@ module Jekyll
# #
# Returns a String representation of the object. # Returns a String representation of the object.
def inspect(input) def inspect(input)
CGI.escapeHTML(input.inspect) xml_escape(input.inspect)
end end
private private