diff options
author | Lars Kanis <[email protected]> | 2020-11-22 14:23:40 +0100 |
---|---|---|
committer | <[email protected]> | 2020-11-22 22:23:40 +0900 |
commit | d403591b34e204a5937241025c62c877e579fbaf () | |
tree | 2ba3966f5c792f74ed0f7873ea8f1def8efa63f3 | |
parent | 2d112c346a7a1369af1236928538a3b3a833f781 (diff) |
Add string encoding IBM720 alias CP720 (#3803)
The mapping table is generated from the ICU project: https://.com/unicode-org/icu/blob/master/icu4c/source/data/mappings/ibm-720_P100-1997.ucm Fixes bug 16233 : https://bugs.ruby-lang.org/issues/16233
Notes: Merged-By: nurse <[email protected]>
-rw-r--r-- | enc/ascii.c | 2 | ||||
-rw-r--r-- | enc/trans/ibm720-tbl.rb | 122 | ||||
-rw-r--r-- | enc/trans/single_byte.trans | 3 | ||||
-rw-r--r-- | ext/win32ole/win32ole.c | 1 | ||||
-rw-r--r-- | spec/ruby/core/string/valid_encoding_spec.rb | 8 | ||||
-rw-r--r-- | test/ruby/test_transcode.rb | 19 |
6 files changed, 154 insertions, 1 deletions
@@ -61,6 +61,8 @@ OnigEncodingDefine(ascii, ASCII) = { ENC_ALIAS("BINARY", "ASCII-8BIT") ENC_REPLICATE("IBM437", "ASCII-8BIT") ENC_ALIAS("CP437", "IBM437") ENC_REPLICATE("IBM737", "ASCII-8BIT") ENC_ALIAS("CP737", "IBM737") ENC_REPLICATE("IBM775", "ASCII-8BIT") @@ -0,0 +1,122 @@ @@ -51,8 +51,9 @@ transcode_tblgen_singlebyte "WINDOWS-1256" transcode_tblgen_singlebyte "WINDOWS-1257" transcode_tblgen_singlebyte "IBM437" - transcode_tblgen_singlebyte "IBM775" transcode_tblgen_singlebyte "IBM737" transcode_tblgen_singlebyte "IBM852" transcode_tblgen_singlebyte "IBM855" transcode_tblgen_singlebyte "IBM857" @@ -507,6 +507,7 @@ static UINT ole_encoding2cp(rb_encoding *enc) ENC_MACHING_CP(enc, "GB2312", 20936); ENC_MACHING_CP(enc, "GBK", 936); ENC_MACHING_CP(enc, "IBM437", 437); ENC_MACHING_CP(enc, "IBM737", 737); ENC_MACHING_CP(enc, "IBM775", 775); ENC_MACHING_CP(enc, "IBM852", 852); @@ -100,6 +100,14 @@ describe "String#valid_encoding?" do str.force_encoding('UTF8-MAC').valid_encoding?.should be_true end it "returns false if self is valid in one encoding, but invalid in the one it's tagged with" do str = "\u{8765}" str.valid_encoding?.should be_true @@ -469,6 +469,25 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u00A0", "\xFF", 'IBM437') # non-breaking space end def test_IBM775 check_both_ways("\u0106", "\x80", 'IBM775') # Ć check_both_ways("\u00C5", "\x8F", 'IBM775') # Å |