* lib/rss/converter.rb: changed to try to use Iconv for default

conversion.
* lib/rss/rss.rb: 0.0.9 -> 0.1.0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2004-10-09 12:30:52 +00:00
Родитель abc8e89324
Коммит 3f5c0f4f6f
3 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Sat Oct 9 21:23:37 2004 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/converter.rb: changed to try to use Iconv for default
conversion.
* lib/rss/rss.rb: 0.0.9 -> 0.1.0.
Sat Oct 9 19:50:36 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_io_getline): should not treat char as negative value.

Просмотреть файл

@ -7,14 +7,15 @@ module RSS
include Utils
def initialize(to_enc, from_enc=nil)
to_enc = to_enc.downcase.gsub(/-/, '_')
normalized_to_enc = to_enc.downcase.gsub(/-/, '_')
from_enc ||= 'utf-8'
from_enc = from_enc.downcase.gsub(/-/, '_')
if to_enc == from_enc
normalized_from_enc = from_enc.downcase.gsub(/-/, '_')
if normalized_to_enc == normalized_from_enc
def_same_enc()
else
if respond_to?("def_to_#{to_enc}_from_#{from_enc}")
send("def_to_#{to_enc}_from_#{from_enc}")
def_diff_enc = "def_to_#{normalized_to_enc}_from_#{normalized_from_enc}"
if respond_to?(def_diff_enc)
__send__(def_diff_enc)
else
def_else_enc(to_enc, from_enc)
end
@ -40,9 +41,9 @@ module RSS
def def_iconv_convert(to_enc, from_enc, depth=0)
begin
require "iconv"
@iconv = Iconv.new(to_enc, from_enc)
def_convert(depth+1) do |value|
<<-EOC
@iconv ||= Iconv.new("#{to_enc}", "#{from_enc}")
begin
@iconv.iconv(#{value})
rescue Iconv::Failure
@ -56,7 +57,7 @@ module RSS
end
def def_else_enc(to_enc, from_enc)
raise UnknownConversionMethodError.new(to_enc, from_enc)
def_iconv_convert(to_enc, from_enc, 0)
end
def def_same_enc()

Просмотреть файл

@ -56,7 +56,7 @@ require "rss/xml-stylesheet"
module RSS
VERSION = "0.0.9"
VERSION = "0.1.0"
URI = "http://purl.org/rss/1.0/"