1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/nkf/nkf-utf8/nkf.c (rb_nkf_convert) (nkf_enc_without_bom):

reverted. nkf-utf8/nkf.c should be independent of ruby.

* ext/nkf/nkf.c (options):
  moved from nkf-utf8/nkf.c. 
  override nkf's original settings for Unicode BOM.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-05-20 13:10:28 +00:00
parent 8405033139
commit 5eb4d70c5f
3 changed files with 2523 additions and 2369 deletions

View file

@ -1,3 +1,12 @@
Tue May 20 20:59:56 2008 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/nkf.c (rb_nkf_convert) (nkf_enc_without_bom):
reverted. nkf-utf8/nkf.c should be independent of ruby.
* ext/nkf/nkf.c (options):
moved from nkf-utf8/nkf.c.
override nkf's original settings for Unicode BOM.
Tue May 20 13:20:51 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/nkf/nkf.c (rb_nkf_convert), ext/nkf/nkf-utf8/nkf.c

File diff suppressed because it is too large Load diff

View file

@ -143,6 +143,15 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
nkf_split_options(RSTRING_PTR(opt));
if (!output_encoding) rb_raise(rb_eArgError, "no output encoding given");
switch (nkf_enc_to_index(output_encoding)) {
case UTF_8_BOM: output_encoding = nkf_enc_from_index(UTF_8); break;
case UTF_16BE_BOM: output_encoding = nkf_enc_from_index(UTF_16BE); break;
case UTF_16LE_BOM: output_encoding = nkf_enc_from_index(UTF_16LE); break;
case UTF_32BE_BOM: output_encoding = nkf_enc_from_index(UTF_32BE); break;
case UTF_32LE_BOM: output_encoding = nkf_enc_from_index(UTF_32LE); break;
}
output_bom_f = FALSE;
incsize = INCSIZE;
input_ctr = 0;
@ -160,7 +169,7 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
rb_str_set_len(result, output_ctr);
OBJ_INFECT(result, src);
rb_enc_associate(result, rb_nkf_enc_get(nkf_enc_name(nkf_enc_without_bom(output_encoding))));
rb_enc_associate(result, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
return result;
}