Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
70c081f8
Commit
70c081f8
authored
Sep 19, 2014
by
Ladislav Martincik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sanitizing Plist UTF8 strings #2482
parent
d90c9545
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
plist.rb
lib/cocoapods/generator/acknowledgements/plist.rb
+25
-6
No files found.
lib/cocoapods/generator/acknowledgements/plist.rb
View file @
70c081f8
...
@@ -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
=>
s
pec
.
name
,
:Title
=>
s
anitize_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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment