1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rss/converter.rb (RSS::Converter): use String#encode.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2008-10-31 13:01:40 +00:00
parent b5a0eb6754
commit ff5a076e7e
2 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Fri Oct 31 21:58:50 2008 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/converter.rb (RSS::Converter): use String#encode.
Fri Oct 31 21:28:14 2008 Yusuke Endoh <mame@tsg.ne.jp>
* lib/webrick/httpauth/digestauth.rb

View file

@ -7,6 +7,10 @@ module RSS
include Utils
def initialize(to_enc, from_enc=nil)
if "".respond_to?(:encode)
@to_encoding = to_enc
return
end
normalized_to_enc = to_enc.downcase.gsub(/-/, '_')
from_enc ||= 'utf-8'
normalized_from_enc = from_enc.downcase.gsub(/-/, '_')
@ -23,7 +27,11 @@ module RSS
end
def convert(value)
value
if value.is_a?(String) and value.respond_to?(:encode)
value.encode(@to_encoding)
else
value
end
end
def def_convert(depth=0)