Skip to content
Browse files

Add support for ks_c_5601-1987 charset, aliased to CP949 Ruby encoding

Fixes #436
  • Loading branch information...
1 parent 80d8557 commit 88457e66ec5b298bd198b5c3b6739f05320a16ee @jeremy jeremy committed Jan 27, 2013
Showing with 12 additions and 2 deletions.
  1. +1 −0 CHANGELOG.rdoc
  2. +4 −0 lib/mail/version_specific/ruby_1_9.rb
  3. +7 −2 spec/mail/encodings_spec.rb
View
1 CHANGELOG.rdoc
@@ -1,6 +1,7 @@
== HEAD
Features:
+* Add support for ks_c_5601-1987 charset, aliased to CP949 Ruby encoding (jeremy)
* Don't allow colons in header names (jeremy)
* Can assign arrays of Message-IDs to References and In-Reply-To (jeremy)
* Setting the html_ or text_part sets a default text/html or text/plain content type (jeremy)
View
4 lib/mail/version_specific/ruby_1_9.rb
@@ -124,6 +124,10 @@ def Ruby19.pick_encoding(charset)
when /^8bit$/
Encoding::ASCII_8BIT
+ # Microsoft-specific alias for CP949 (Korean)
+ when 'ks_c_5601-1987'
+ Encoding::CP949
+
else
charset
end
View
9 spec/mail/encodings_spec.rb
@@ -149,12 +149,17 @@
Mail::Encodings.value_decode(string).should == result
end
- it "should decode 8bit encoded string" do
- if RUBY_VERSION >= '1.9'
+ if '1.9'.respond_to?(:force_encoding)
+ it "should decode 8bit encoded string" do
string = "=?8bit?Q?ALPH=C3=89E?="
result = "ALPH\xC3\x89E"
Mail::Encodings.value_decode(string).should == result
end
+
+ it "should decode ks_c_5601-1987 encoded string" do
+ string = '=?ks_c_5601-1987?B?seggx/bB+A==?= <a@b.org>'.force_encoding('us-ascii')
+ Mail::Encodings.value_decode(string).should == "김 현진 <a@b.org>"
+ end
end
end

0 comments on commit 88457e6

Please sign in to comment.
Something went wrong with that request. Please try again.