ruby-changes:1801
From: ko1@a...
Date: 28 Aug 2007 14:21:57 +0900
Subject: [ruby-changes:1801] nobu - Ruby:r13292 (trunk): * parse.y (parser_prepare): set parser encode too when BOM exists.
nobu 2007-08-28 14:21:48 +0900 (Tue, 28 Aug 2007) New Revision: 13292 Modified files: trunk/ChangeLog trunk/parse.y Log: * parse.y (parser_prepare): set parser encode too when BOM exists. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=13292&r2=13291 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13292&r2=13291 Index: ChangeLog =================================================================== --- ChangeLog (revision 13291) +++ ChangeLog (revision 13292) @@ -1,3 +1,7 @@ +Tue Aug 28 14:21:46 2007 Nobuyoshi Nakada <nobu@r...> + + * parse.y (parser_prepare): set parser encode too when BOM exists. + Tue Aug 28 00:51:22 2007 Koichi Sasada <ko1@a...> * thread.c: fix Mutex to be interruptable lock. Index: parse.y =================================================================== --- parse.y (revision 13291) +++ parse.y (revision 13292) @@ -5490,6 +5490,13 @@ } /* emacsen -*- hack */ +static void +parser_set_encode(struct parser_params *parser, const char *name) +{ + rb_set_kcode(name); + parser->enc = rb_enc_find(name); +} + #ifndef RIPPER typedef void (*rb_pragma_setter_t)(struct parser_params *parser, const char *name, const char *val); @@ -5498,8 +5505,7 @@ { if (parser && parser->line_count != (parser->has_shebang ? 2 : 1)) return; - rb_set_kcode(val); - parser->enc = rb_enc_find(val); + parser_set_encode(parser, val); } struct pragma { @@ -5641,7 +5647,7 @@ if (lex_pend - lex_p >= 2 && (unsigned char)lex_p[0] == 0xbb && (unsigned char)lex_p[1] == 0xbf) { - rb_set_kcode("UTF-8"); + parser_set_encode(parser, "UTF-8"); lex_p += 2; return; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml