mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
encdb.c, utf_16_32.h: Unicode with BOM
* enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): Unicode with BOM must be based on big endian variants, so that actual encodings would work. [ruby-core:57318] [Bug #8940] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e6fe59e96e
commit
3a2aca5075
4 changed files with 15 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Sep 23 22:16:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): Unicode with BOM
|
||||
must be based on big endian variants, so that actual encodings would
|
||||
work. [ruby-core:57318] [Bug #8940]
|
||||
|
||||
Mon Sep 23 12:11:26 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* hash.c (env_each_pair): do not call rb_assoc_new() if
|
||||
|
|
|
@ -20,7 +20,7 @@ void rb_encdb_set_unicode(int index);
|
|||
#define ENC_DUMMY(name) rb_encdb_dummy(name)
|
||||
#define ENC_DEFINE(name) rb_encdb_declare(name)
|
||||
#define ENC_SET_BASE(name, orig) rb_enc_set_base((name), (orig))
|
||||
#define ENC_DUMMY_UNICODE(name) rb_encdb_set_unicode(ENC_DUMMY(name))
|
||||
#define ENC_DUMMY_UNICODE(name) rb_encdb_set_unicode(ENC_REPLICATE((name), name "BE"))
|
||||
|
||||
void
|
||||
Init_encdb(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "regenc.h"
|
||||
/* dummy for unsupported, statefull encoding */
|
||||
#define ENC_DUMMY_UNICODE(name) ENC_DUMMY(name)
|
||||
#define ENC_DUMMY_UNICODE(name) ENC_REPLICATE(name, name "BE")
|
||||
ENC_DUMMY_UNICODE("UTF-16");
|
||||
ENC_DUMMY_UNICODE("UTF-32");
|
||||
|
|
|
@ -2063,4 +2063,11 @@ class TestTranscode < Test::Unit::TestCase
|
|||
end
|
||||
assert_equal("U+3042", "\u{3042}".encode("US-ASCII", fallback: fallback.method(:escape)))
|
||||
end
|
||||
|
||||
bug8940 = '[ruby-core:57318] [Bug #8940]'
|
||||
%w[UTF-32 UTF-16].each do |enc|
|
||||
define_method("test_pseudo_encoding_inspect(#{enc})") do
|
||||
assert_normal_exit("'aaa'.encode('#{enc}').inspect", bug8940)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue