[#41251] mswin32(もしくはActiveScriptRuby)でRuby/Tkを使うには? — "conundrum /" <conundrum@...>

conundrumです。

12 messages 2005/10/11

[#41284] 条件に合う見出しの内容だけを抽出 — isawa_kz <isawa_kz@...>

井沢と申します。

32 messages 2005/10/14
[#41299] Re: 条件に合う見出しの内容だけを抽出 — Kousuke Honda <kousuke4@...> 2005/10/14

本田です。はじめましてです。

[#41300] Re: 条件に合う見出しの内容だけを抽出 — isawa_kz <isawa_kz@...> 2005/10/14

井沢です

[#41301] Re: 条件に合う見出しの内容だけを抽出 — しん <dezawa@...> 2005/10/14

出沢です

[#41340] Date へのメソッド追加要望 — MATSUNO Tokuhiro <tokuhirom@...>

tokuhirom@Inamode6:897 です。

19 messages 2005/10/22

[#41371] 北九州市の rubyist へ — Akimichi Tatsukawa <akimichi_tatsukawa@...>

こんにちは。立川察理と申します。

13 messages 2005/10/25

[#41400] 全角スペースを区切りとした文字列分解で — 中村 英夫 <cxn03651@...>

中村と申します。

10 messages 2005/10/27

[#41416] Rubyでこういうの作れますか?(中央銀行編) — Omoti <omoti@...24.net>

Rubyで中央銀行システムを作りたいんですが、できますか?

14 messages 2005/10/29
[#41418] Re: Ruby でこういうの作れますか?(中央銀行編) — Sako Hiroshi <sakoh@...2.so-net.ne.jp> 2005/10/29

[#41420] Re: Ruby でこういうの作れますか?(中央銀行編) — Omoti <omoti@...24.net> 2005/10/29

そんな大規模じゃないですよ!

[#41425] "Programming Ruby 2nd edtion"の邦訳について — "higashi ryota" <ryochin_hgs@...>

始めまして。既出だったらすいません、過去ログで検索したのですが見つけられませ

10 messages 2005/10/30
[#41428] Re: "Programming Ruby 2nd edtion"の邦訳について — Yukihiro Matsumoto <matz@...> 2005/10/30

まつもと ゆきひろです

[ruby-list:41337] Re: rexmlの文字エンコードライブラリの変更

From: 杉原 透修 <sugihara.yukino@...>
Date: 2005-10-19 00:00:33 UTC
List: ruby-list #41337
中田様

ご回答ありがとうございます。
教えていただいた下記コードを追記することで
Uconvでのエンコードが有効になっているようです。
--------------------------------------------
require "rexml/document"
require "rexml/encodings/ICONV"
module REXML::Encoding
  @encoding_methods.delete("ICONV")
end
--------------------------------------------

もともとIconvの利用は想定していなかったため
この方法でなんとかなるかと思います。

ありがとうございました。


> なかだです。
> 
> At Tue, 18 Oct 2005 09:58:43 +0900,
> 杉原 透修 wrote in [ruby-list:41325]:
> > rexmlに「①」等の特殊記号を渡すとエラーで落ちてしまいます。
> > 以下のコードで再現します。
> 
> iconvを一切使わないようにするのでよければ、変換メソッド登録のテー
> ブルから消してしまうという方法はあります。
> 
> > require "rexml/document"
>   require "rexml/encodings/ICONV"
>   module REXML::Encoding
>     @encoding_methods.delete("ICONV")
>   end
> 
> あるいはrexml/encodings/ICONV.rbをすでに読み込んだことにして登
> 録させないとか。
> 
>   $" << "rexml/encodings/ICONV.rb"
> 
> どちらも内部構造に強く依存するという点では望ましくないのは確か
> ですが。
> 
> > 単にIconvで文字エンコードに失敗しているだけだと思うのですが
> > IconvよりもUconvを優先して文字エンコード出来ないかと考えています。
> 
> iconvはよくいえば汎用、ぶっちゃけ(大本の規格からして)中途半端な
> ので、私も専用の変換を優先したほうがいいのではないかと思います
> が、rexmlの作者のSean Russellにはまた別の考えがあるのかもしれま
> せん。
> 
> > rubyインストール時にiconv無効オプションも無いようですのでrexmlのソース
> > を変更する必要があるかと思うのですが、奥が深く修正箇所が判明しておりません。
> > 下記サイトで対応されていらっしゃる方もおられるようですが、修正箇所
> > について、どなたかご教示いただけないでしょうか?
> 
> --without-iconvでコンパイルしなくするというパッチ[1]はまだ入っ
> てませんね。ext/iconv/extconf.rbを消しておくだけでもコンパイル
> されなくはなりますが。
> 
> [1] http://www.dm4lab.to/~usa/ruby/d/200510b.html#id20051016_P1_2
> 
> 
> Index: lib/rexml/encoding.rb
> ===================================================================
> RCS file: /cvs/ruby/src/ruby/lib/rexml/encoding.rb,v
> retrieving revision 1.5.2.1
> diff -U2 -p -w -r1.5.2.1 encoding.rb
> --- lib/rexml/encoding.rb	19 May 2005 03:51:52 -0000	1.5.2.1
> +++ lib/rexml/encoding.rb	18 Oct 2005 02:10:51 -0000
> @@ -26,26 +26,20 @@ module REXML
>  				$VERBOSE = false
>  				return if defined? @encoding and enc == @encoding
> -				if enc and enc != UTF_8
> -					@encoding = enc.upcase
> +				if enc
> +					raise ArgumentError, "Bad encoding name #{enc}" unless /\A[\w-]+\z/n =~ enc
> +					@encoding = enc.upcase.untaint
> +				else
> +					@encoding = UTF_8
> +				end
> +				err = nil
> +				[@encoding, "ICONV"].each do |enc|
>  					begin
> -                                               require 'rexml/encodings/ICONV.rb'
> -                                               Encoding.apply(self, "ICONV")
> +						require File.join("rexml", "encodings", "#{enc}.rb")
> +						return Encoding.apply(self, enc)
>  					rescue LoadError, Exception => err
> -                                               raise ArgumentError, "Bad encoding name #@encoding" unless @encoding =~ /^[\w-]+$/
> -						@encoding.untaint 
> -						enc_file = File.join( "rexml", "encodings", "#@encoding.rb" )
> -						begin
> -                                                       require enc_file
> -                                                       Encoding.apply(self, @encoding)
> -						rescue LoadError
> -                                                       puts $!.message
> -                                                       raise ArgumentError, "No decoder found for encoding #@encoding.  Please install iconv."
>  						end
>  					end
> -				else
> -                                       @encoding = UTF_8
> -                                       require 'rexml/encodings/UTF-8.rb'
> -                                       Encoding.apply(self, @encoding)
> -				end
> +				puts err.message
> +				raise ArgumentError, "No decoder found for encoding #@encoding.  Please install iconv."
>  			ensure
>  				$VERBOSE = old_verbosity
> 
> 
> -- 
> --- 僕の前にBugはない。
> --- 僕の後ろにBugはできる。
>     中田 伸悦
> 



In This Thread

Prev Next