Commit 70c081f8 authored by Ladislav Martincik's avatar Ladislav Martincik

Sanitizing Plist UTF8 strings #2482

parent d90c9545
...@@ -36,8 +36,8 @@ module Pod ...@@ -36,8 +36,8 @@ module Pod
if (license = license_text(spec)) if (license = license_text(spec))
{ {
:Type => 'PSGroupSpecifier', :Type => 'PSGroupSpecifier',
:Title => spec.name, :Title => sanitize_encoding(spec.name),
:FooterText => license, :FooterText => sanitize_encoding(license),
} }
end end
end end
...@@ -45,18 +45,37 @@ module Pod ...@@ -45,18 +45,37 @@ module Pod
def header_hash def header_hash
{ {
:Type => 'PSGroupSpecifier', :Type => 'PSGroupSpecifier',
:Title => header_title, :Title => sanitize_encoding(header_title),
:FooterText => header_text, :FooterText => sanitize_encoding(header_text),
} }
end end
def footnote_hash def footnote_hash
{ {
:Type => 'PSGroupSpecifier', :Type => 'PSGroupSpecifier',
:Title => footnote_title, :Title => sanitize_encoding(footnote_title),
:FooterText => footnote_text, :FooterText => sanitize_encoding(footnote_text),
} }
end end
#-----------------------------------------------------------------------#
private
# !@group Private methods
# Returns the sanitized text with UTF-8 eliminating invalid characters.
#
# @param [String] text
# the text we want to sanitize.
#
# @return [String] The sanitized text.
#
def sanitize_encoding(text)
text.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
end
#-----------------------------------------------------------------------#
end end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment