зеркало из https://github.com/github/ruby.git
* transcode.c (stateless_encoding_i): ignore supplemental conversions.
Encoding::Converter.stateless_encoding("html-attr-escaped") should be nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
091171a286
Коммит
393f57670f
|
@ -1,3 +1,9 @@
|
|||
Sat Sep 6 12:25:31 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* transcode.c (stateless_encoding_i): ignore supplemental conversions.
|
||||
Encoding::Converter.stateless_encoding("html-attr-escaped") should be
|
||||
nil.
|
||||
|
||||
Sat Sep 6 12:19:36 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* enc/trans/escape.trans (escape_html_attr_init): new function.
|
||||
|
|
|
@ -34,6 +34,7 @@ class TestEncodingConverter < Test::Unit::TestCase
|
|||
assert_nil(Encoding::Converter.stateless_encoding("UTF-8"))
|
||||
assert_nil(Encoding::Converter.stateless_encoding("UTF-16BE"))
|
||||
assert_nil(Encoding::Converter.stateless_encoding(Encoding::UTF_8))
|
||||
assert_nil(Encoding::Converter.stateless_encoding("html-attr-escaped"))
|
||||
end
|
||||
|
||||
def test_stateless_encoding_iso2022jp
|
||||
|
|
|
@ -133,6 +133,8 @@ struct rb_econv_t {
|
|||
* Dispatch data and logic
|
||||
*/
|
||||
|
||||
#define SUPPLEMENTAL_CONVERSION(sname, dname) (*(sname) == '\0' || *(dname) == '\0')
|
||||
|
||||
typedef struct {
|
||||
const char *sname;
|
||||
const char *dname;
|
||||
|
@ -1635,7 +1637,11 @@ stateless_encoding_i(st_data_t key, st_data_t val, st_data_t arg)
|
|||
|
||||
if (st_lookup(table2, (st_data_t)data->stateful_enc, &v)) {
|
||||
transcoder_entry_t *entry = (transcoder_entry_t *)v;
|
||||
const rb_transcoder *tr = load_transcoder_entry(entry);
|
||||
const rb_transcoder *tr;
|
||||
if (SUPPLEMENTAL_CONVERSION(entry->sname, entry->dname)) {
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
tr = load_transcoder_entry(entry);
|
||||
if (tr && tr->stateful_type == stateful_encoder) {
|
||||
data->stateless_enc = tr->src_encoding;
|
||||
return ST_STOP;
|
||||
|
|
Загрузка…
Ссылка в новой задаче