Subject: pkg/28535: textproc/ruby-rexml 3.1.2 fail to handle shift_jis code
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <obata@zit.to>
List: pkgsrc-bugs
Date: 12/04/2004 12:12:00
>Number:         28535
>Category:       pkg
>Synopsis:       textproc/ruby-rexml 3.1.2 fail to handle shift_jis code
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 04 12:12:00 +0000 2004
>Originator:     OBATA Akio
>Release:        NetBSD 2.0_RC4
>Organization:
GURU-GURU
>Environment:
System: NetBSD miki 2.0_RC4 NetBSD 2.0_RC4 (MIKI) #1: Sun Oct 10 23:09:39 JST 2004 obata@miki:/usr/src/sys/arch/i386/compile/MIKI i386
Architecture: i386
Machine: i386
>Description:
	ruby-rexml can't handle shift_jis codes correctly on NetBSD.
	1. encoding name for iconv (shift-jis -> shift_jis)
	2. typo & bugs in ruby-rexml 3.1.2
>How-To-Repeat:
	use XML files in shift_jis encoding.
>Fix:
patches

--- src/rexml/encodings/SHIFT-JIS.rb.orig	2004-06-21 01:04:48.000000000 +0900
+++ src/rexml/encodings/SHIFT-JIS.rb	2004-09-24 23:39:30.000000000 +0900
@@ -5,11 +5,11 @@
     module Encoding
       @@__REXML_encoding_methods =<<-EOL
       def decode(str)
-        return Iconv::iconv("utf-8", "shift-jis", str)[0]
+        return Iconv::iconv("utf-8", "shift_jis", str)[0]
       end
 
       def encode content
-        return Iconv::iconv("shift-jis", "utf-8", content)[0]
+        return Iconv::iconv("shift_jis", "utf-8", content)[0]
       end
       EOL
     end
@@ -21,11 +21,11 @@
     module REXML
       module Encoding
         @@__REXML_encoding_methods =<<-EOL
-        def to_shift_jis content
+        def encode content
           Uconv::u8tosjis(content)
         end
 
-        def from_shift_jis(str)
+        def decode(str)
           Uconv::sjistou8(str)
         end
         EOL

--- src/rexml/encodings/SHIFT_JIS.rb.orig	2004-06-21 01:04:47.000000000 +0900
+++ src/rexml/encodings/SHIFT_JIS.rb	2004-09-07 10:08:03.000000000 +0900
@@ -1 +1 @@
-require 'rexml/encodings/Shift-JIS'
+load 'rexml/encodings/SHIFT-JIS.rb'