diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-01 15:41:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-01 15:41:31 +0000 |
commit | 26fcfd1bb5c39506f3be79b0bb9be2efce8febab (patch) | |
tree | 6b2db095d7cb76f54bbb8e1659b4d53999bb2ef2 /ext/iconv/charset_alias.rb | |
parent | 6f8f0a86f5964f36ea81b327c1f4538a9ccedbd2 (diff) |
* ext/iconv/iconv.c (map_charset): use lower case keys.
* ext/iconv/iconv.c (iconv_fail): just yield error and return the
result if a block is given.
* ext/iconv/iconv.c (iconv_convert): yield error and append the
result if a block is given.
* ext/iconv/charset_alias.rb (charset_alias): optional third
argument.
* ext/iconv/charset_alias.rb (charset_alias): use CP932 instead of
SHIFT_JIS on cygwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/iconv/charset_alias.rb')
-rw-r--r-- | ext/iconv/charset_alias.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/iconv/charset_alias.rb b/ext/iconv/charset_alias.rb index 20a7f6406a..48f0fae5f9 100644 --- a/ext/iconv/charset_alias.rb +++ b/ext/iconv/charset_alias.rb @@ -1,16 +1,16 @@ #! /usr/bin/ruby require 'rbconfig' -# http://www.ctan.org/tex-archive/macros/texinfo/texinfo/intl/config.charset' +# http://www.ctan.org/tex-archive/macros/texinfo/texinfo/intl/config.charset # Fri, 30 May 2003 00:09:00 GMT' OS = Config::CONFIG["target"] SHELL = Config::CONFIG['SHELL'] -def charset_alias(config_charset, mapfile) +def charset_alias(config_charset, mapfile, target = OS) map = {} comments = [] - IO.foreach("|#{SHELL} #{config_charset} #{OS}") do |list| + IO.foreach("|#{SHELL} #{config_charset} #{target}") do |list| next comments << list if /^\#/ =~ list next unless /^(\S+)\s+(\S+)$/ =~ list sys, can = $1, $2 @@ -18,9 +18,12 @@ def charset_alias(config_charset, mapfile) next if can.downcase! and sys == can map[can] = sys end - case OS + case target when /linux|-gnu/ map.delete('ascii') + when /cygwin/ + # get rid of tilde/yen problem. + map['shift_jis'] = 'cp932' end open(mapfile, "w") do |f| f.puts("require 'iconv.so'") @@ -32,5 +35,5 @@ def charset_alias(config_charset, mapfile) end end -ARGV.size == 2 or abort "usage: #$0 config.status map.rb" +(2..3) === ARGV.size or abort "usage: #$0 config.status map.rb [target]" charset_alias(*ARGV) |