Forces UTF-8 encoding when enumerating usernames - Fixes #801

This commit is contained in:
erwanlr
2015-04-11 12:26:15 +01:00
parent 4fbc535b0c
commit a4bbf41086
3 changed files with 25 additions and 3 deletions

View File

@@ -39,7 +39,9 @@ class WpUser < WpItem
#
# @return [ String ] The login
def self.login_from_author_pattern(text)
text[%r{/author/([^/\b]+)/?}i, 1]
return unless text =~ %r{/author/([^/\b]+)/?}i
Regexp.last_match[1].force_encoding('UTF-8')
end
# @param [ String ] body
@@ -52,6 +54,7 @@ class WpUser < WpItem
unless login
# No Permalinks
login = body[%r{<body class="archive author author-([^\s]+)[ "]}i, 1]
login ? login.force_encoding('UTF-8') : nil
end
login