ÃæÅÄÍÍ

¤´²óÅú¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£
¶µ¤¨¤Æ¤¤¤¿¤À¤¤¤¿²¼µ­¥³¡¼¥É¤òÄɵ­¤¹¤ë¤³¤È¤Ç
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¤Ï¤Ç¤­¤ë¡£ > ÃæÅÄ ¿­±Ù >