From 52817c3654518c55de31666848f08d7ac58f8787 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 4 Sep 2006 07:40:46 +0000 Subject: * lib/cgi.rb (CGI::out): specify -x option for nkf. * lib/cgi.rb (CGI::out): should not convert utf-8 implicitly using NKF. it is too Japanese centric. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ enum.c | 21 +++++++++++++++++++++ ext/dbm/extconf.rb | 1 - lib/cgi.rb | 8 +++----- process.c | 2 ++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59f30215b2..466cb0398d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Sep 4 16:39:11 2006 Yukihiro Matsumoto + + * lib/cgi.rb (CGI::out): specify -x option for nkf. + + * lib/cgi.rb (CGI::out): should not convert utf-8 implicitly using + NKF. it is too Japanese centric. + +Mon Sep 4 14:23:10 2006 Yukihiro Matsumoto + + * ext/dbm/extconf.rb (db_check): remove debug print. + Mon Sep 4 06:46:08 2006 Yukihiro Matsumoto * parse.y (rb_id2sym): intern if id is attrset_id. diff --git a/enum.c b/enum.c index 419a2b98e4..919c53b482 100644 --- a/enum.c +++ b/enum.c @@ -1187,6 +1187,27 @@ enum_zip(int argc, VALUE *argv, VALUE obj) return result; } +static VALUE +in_i(VALUE i, VALUE *memo) +{ + if (rb_equal(i, memo[0])) { + memo[1] = Qtrue; + rb_iter_break(); + } + return Qnil; +} + +VALUE +rb_enum_in(VALUE elem, VALUE obj) +{ + VALUE memo[2]; + + memo[0] = elem; + memo[1] = Qfalse; + rb_block_call(obj, id_each, 0, 0, in_i, (VALUE)&memo); + return memo[1]; +} + /* * The Enumerable mixin provides collection classes with * several traversal and searching methods, and with the ability to diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb index 41996c417c..7a69acc7a6 100644 --- a/ext/dbm/extconf.rb +++ b/ext/dbm/extconf.rb @@ -34,7 +34,6 @@ def db_check(db) for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"]) if have_header(hdr.dup) and have_type("DBM", hdr.dup, hsearch) $defs << hsearch << '-DDBM_HDR="<'+hdr+'>"' - p $defs return true end end diff --git a/lib/cgi.rb b/lib/cgi.rb index 4cd497849a..8d6705c44a 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -718,16 +718,14 @@ class CGI require "nkf" case options["charset"] when /iso-2022-jp/ni - content = NKF::nkf('-j -m0', content) + content = NKF::nkf('-j -m0 -x', content) options["language"] = "ja" unless options.has_key?("language") when /euc-jp/ni - content = NKF::nkf('-e -m0', content) + content = NKF::nkf('-e -m0 -x', content) options["language"] = "ja" unless options.has_key?("language") when /shift_jis/ni - content = NKF::nkf('-s -m0', content) + content = NKF::nkf('-s -m0 -x', content) options["language"] = "ja" unless options.has_key?("language") - when /utf-8/ni - content = NKF::nkf('-w -m0', content) end end diff --git a/process.c b/process.c index 843320193c..b0886071a7 100644 --- a/process.c +++ b/process.c @@ -1173,9 +1173,11 @@ rb_check_argv(int argc, VALUE *argv) prog = RARRAY_PTR(tmp)[0]; argv[0] = RARRAY_PTR(tmp)[1]; SafeStringValue(prog); + StringValueCStr(prog); } for (i = 0; i < argc; i++) { SafeStringValue(argv[i]); + StringValueCStr(argv[i]); } security(RSTRING_PTR(prog ? prog : argv[0])); return prog; -- cgit v1.2.3