From 634cfdc6e675e0643df699780dbbf44ff4854640 Mon Sep 17 00:00:00 2001 From: naruse Date: Thu, 9 Jul 2009 14:47:48 +0000 Subject: Set encoding and strip bom when modeenc string is "r:foo-bom" [ruby-dev:37236] * include/ruby/io.h (FMODE_STRIP_BOM): new constant. * io.c (io_encname_bom_p): judge whether the encoding name is *-bom or not. (parse_mode_enc): drop "-bom". (rb_io_modestr_fmode): set FMODE_STRIP_BOM if needed. (rb_io_extract_modeenc): ditto. (io_strip_bom): strip bom if exists. (io_set_encoding_by_bom): set encoding if there is bom. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/io.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ruby/io.h') diff --git a/include/ruby/io.h b/include/ruby/io.h index 64773549f5..7d9512aa92 100644 --- a/include/ruby/io.h +++ b/include/ruby/io.h @@ -94,6 +94,7 @@ typedef struct rb_io_t { #define FMODE_TEXTMODE 0x00001000 #define FMODE_EOF 0x00002000 /* #define FMODE_PREP 0x00010000 */ +#define FMODE_STRIP_BOM 0x00100000 #define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr) -- cgit v1.2.3