From 7c69f166bd05703ecf8ed07fac0927f5fc9b22fa Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 27 Jan 2008 15:39:14 +0000 Subject: [PATCH] * parse.y (parser_set_encode): check if encoding is ASCII compatible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ parse.y | 8 +++++++- version.h | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index adfdf9a6f6..18bea96e0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jan 28 00:39:09 2008 Nobuyoshi Nakada + + * parse.y (parser_set_encode): check if encoding is ASCII compatible. + Sun Jan 27 23:33:35 2008 Nobuyoshi Nakada * sprintf.c (rb_str_format): fix for left justify flag. diff --git a/parse.y b/parse.y index 6164ba46e1..19b8ba658c 100644 --- a/parse.y +++ b/parse.y @@ -5746,10 +5746,16 @@ static void parser_set_encode(struct parser_params *parser, const char *name) { int idx = rb_enc_find_index(name); + rb_encoding *enc; + if (idx < 0) { rb_raise(rb_eArgError, "unknown encoding name: %s", name); } - parser->enc = rb_enc_from_index(idx); + enc = rb_enc_from_index(idx); + if (!rb_enc_asciicompat(enc)) { + rb_raise(rb_eArgError, "%s is not ASCII compatible", rb_enc_name(enc)); + } + parser->enc = enc; } #ifndef RIPPER diff --git a/version.h b/version.h index 66b74b191f..8f7a23cde3 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2008-01-26" +#define RUBY_RELEASE_DATE "2008-01-28" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20080126 +#define RUBY_RELEASE_CODE 20080128 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 26 +#define RUBY_RELEASE_DAY 28 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];