[#6143] — Christophe Poucet <christophe.poucet@...>

Hello,

17 messages 2005/10/04
[#6147] Re: patch.tgz — nobu.nokada@... 2005/10/04

Hi,

[#6199] Kernel rdoc HTML file not being created when rdoc is run on 1.8.3 — James Britt <ruby@...>

When 1.8.3 came out, I grabbed the source and ran rdoc on it. After

9 messages 2005/10/08

[#6251] RubyGems, upstream releases and idempotence of packaging — Mauricio Fern疣dez <mfp@...>

[sorry for the very late reply; I left this message in +postponed and forgot

14 messages 2005/10/12

[#6282] Wilderness: Need Code to invoke ELTS_SHARED response — "Charles E. Thornton" <ruby-core@...>

Testing the My Object Dump and I am trying to cause creation

13 messages 2005/10/14
[#6283] Re: Wilderness: Need Code to invoke ELTS_SHARED response — Mauricio Fern疣dez <mfp@...> 2005/10/14

On Fri, Oct 14, 2005 at 05:04:59PM +0900, Charles E. Thornton wrote:

[#6288] Re: Wilderness: Need Code to invoke ELTS_SHARED response — "Charles E. Thornton" <ruby-core@...> 2005/10/14

Mauricio Fern疣dez wrote:

[#6365] Time for built-in Rational and Complex classes? — Gavin Sinclair <gsinclair@...>

There has been some support for, but no comment on, RCR #260 ("Make

12 messages 2005/10/24
[#6366] Re: Time for built-in Rational and Complex classes? — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/24

On Mon, 24 Oct 2005, Gavin Sinclair wrote:

[#6405] Re: [PATCH] Pathname.exists?() — "Berger, Daniel" <Daniel.Berger@...>

12 messages 2005/10/25
[#6406] Re: [PATCH] Pathname.exists?() — TRANS <transfire@...> 2005/10/25

On 10/25/05, Berger, Daniel <Daniel.Berger@qwest.com> wrote:

[#6408] Re: [PATCH] Pathname.exists?() — Gavin Sinclair <gsinclair@...> 2005/10/25

On 10/26/05, TRANS <transfire@gmail.com> wrote:

[#6442] Wilderness: I Have formatted README.EXT into an HTML Document — "Charles E. Thornton" <ruby-core@...>

I have taken README.EXT (English Version Only) and have reformatted

14 messages 2005/10/27

[#6469] csv.rb a start on refactoring. — Hugh Sasse <hgs@...>

For a database application I found using CSV to be rather slow.

50 messages 2005/10/28
[#6470] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/28

[#6471] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/28

On Oct 28, 2005, at 8:53 AM, Ara.T.Howard wrote:

[#6474] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/28

On Fri, 28 Oct 2005, James Edward Gray II wrote:

[#6484] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 9:58 AM, Ara.T.Howard wrote:

[#6485] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sat, 29 Oct 2005, James Edward Gray II wrote:

[#6486] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 8:25 PM, Ara.T.Howard wrote:

[#6487] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sat, 29 Oct 2005, James Edward Gray II wrote:

[#6491] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 8:43 PM, Ara.T.Howard wrote:

[#6493] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 10:06 PM, James Edward Gray II wrote:

[#6496] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sun, 30 Oct 2005, James Edward Gray II wrote:

[#6502] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/30

On Oct 29, 2005, at 12:11 PM, Ara.T.Howard wrote:

[#6505] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/30

On Mon, 31 Oct 2005, James Edward Gray II wrote:

[#6511] Planning FasterCSV (was Re: csv.rb a start on refactoring.) — James Edward Gray II <james@...> 2005/10/30

I've decided to create a FasterCSV library, based on the code we

[#6516] Re: Planning FasterCSV (was Re: csv.rb a start on refactoring.) — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/31

On Mon, 31 Oct 2005, James Edward Gray II wrote:

[#6518] Re: Planning FasterCSV (was Re: csv.rb a start on refactoring.) — "NAKAMURA, Hiroshi" <nakahiro@...> 2005/10/31

-----BEGIN PGP SIGNED MESSAGE-----

[REXML] encoding precedence

From: nobuyoshi nakada <nobuyoshi.nakada@...>
Date: 2005-10-31 05:57:52 UTC
List: ruby-core #6520
Hi,

Currently, REXML prefers iconv module to convert encodings.
Iconv can be useful for general purpose, but, to be frank, is
halfdone, I guess.  In many cases, particular conversion
engines would be much preferable if available.

Also, nkf module, a bundled library, can deal with Japanese
characters in utf-8 as well as in others already, so I'd like
to give priority nkf to over uconv, which is not bundled.


Index: ruby-ruby_1_8/lib/rexml/encoding.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/rexml/encoding.rb,v
retrieving revision 1.5.2.1
diff -U2 -p -r1.5.2.1 encoding.rb
--- ruby-ruby_1_8/lib/rexml/encoding.rb	19 May 2005 03:51:52 -0000	1.5.2.1
+++ ruby-ruby_1_8/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
Index: ruby-ruby_1_8/lib/rexml/encodings/EUC-JP.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/rexml/encodings/EUC-JP.rb,v
retrieving revision 1.6.2.1
diff -U2 -p -r1.6.2.1 EUC-JP.rb
--- ruby-ruby_1_8/lib/rexml/encodings/EUC-JP.rb	19 May 2005 03:51:53 -0000	1.6.2.1
+++ ruby-ruby_1_8/lib/rexml/encodings/EUC-JP.rb	31 Oct 2005 04:31:52 -0000
@@ -1,12 +1,27 @@
-require 'uconv'
-
 module REXML
   module Encoding
-    def decode_eucjp(str)
-      Uconv::euctou8(str)
-    end
+    begin
+      require 'uconv'
+
+      def decode_eucjp(str)
+        Uconv::euctou8(str)
+      end
+
+      def encode_eucjp content
+        Uconv::u8toeuc(content)
+      end
+    rescue LoadError
+      require 'nkf'
+
+      EUCTOU8 = '-Ewm0'
+      U8TOEUC = '-Wem0'
 
-    def encode_eucjp content
-      Uconv::u8toeuc(content)
+      def decode_eucjp(str)
+        NKF.nkf(EUCTOU8, str)
+      end
+
+      def encode_eucjp content
+        NKF.nkf(U8TOEUC, content)
+      end
     end
 
Index: ruby-ruby_1_8/lib/rexml/encodings/SHIFT-JIS.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/rexml/encodings/SHIFT-JIS.rb,v
retrieving revision 1.2.2.3
diff -U2 -p -r1.2.2.3 SHIFT-JIS.rb
--- ruby-ruby_1_8/lib/rexml/encodings/SHIFT-JIS.rb	19 May 2005 10:08:11 -0000	1.2.2.3
+++ ruby-ruby_1_8/lib/rexml/encodings/SHIFT-JIS.rb	31 Oct 2005 04:31:52 -0000
@@ -1,12 +1,27 @@
-require 'uconv'
-
 module REXML
   module Encoding
-    def decode_sjis content
-      Uconv::sjistou8(content)
-    end
+    begin
+      require 'uconv'
+
+      def decode_sjis content
+        Uconv::sjistou8(content)
+      end
+
+      def encode_sjis(str)
+        Uconv::u8tosjis(str)
+      end
+    rescue LoadError
+      require 'nkf'
+
+      SJISTOU8 = '-Swm0'
+      U8TOSJIS = '-Wsm0'
 
-    def encode_sjis(str)
-      Uconv::u8tosjis(str)
+      def decode_sjis(str)
+        NKF.nkf(SJISTOU8, str)
+      end
+
+      def encode_sjis content
+        NKF.nkf(U8TOSJIS, content)
+      end
     end
 


-- 
Nobu Nakada

In This Thread

Prev Next