commit 182d4dcbc2450e372178f37f5085f2d81fb96a7d
parent dd8dc5e703b9880d10427a1c70b4f7adcdfa2479
Author: Nicolas Pouillard <nicolas.pouillard@gmail.com>
Date: Mon, 16 Mar 2009 19:56:17 +0100
decoding: handle more misspellings, in particular ISO-8859-15
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/sup/util.rb b/lib/sup/util.rb
@@ -620,11 +620,12 @@ end
class Iconv
def self.easy_decode target, charset, text
- return text if charset =~ /^(x-unknown|unknown[-_]?8bit|ascii[-_]?7[-_]?bit)$/i
+ return text if charset =~ /^(x-unknown|unknown[-_ ]?8bit|ascii[-_ ]?7[-_ ]?bit)$/i
charset = case charset
- when /UTF[-_]?8/i: "utf-8"
- when /(iso[-_])?latin[-_]?1$/i: "ISO-8859-1"
- when /unicode[-_]1[-_]1[-_]utf[-_]7/i: "utf-7"
+ when /UTF[-_ ]?8/i: "utf-8"
+ when /(iso[-_ ])?latin[-_ ]?1$/i: "ISO-8859-1"
+ when /iso[-_ ]?8859[-_ ]?15/i: 'ISO-8859-15'
+ when /unicode[-_ ]1[-_ ]1[-_ ]utf[-_]7/i: "utf-7"
else charset
end