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:
parent
b5a0eb6754
commit
ff5a076e7e
2 changed files with 13 additions and 1 deletions
|
@ -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>
|
Fri Oct 31 21:28:14 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* lib/webrick/httpauth/digestauth.rb
|
* lib/webrick/httpauth/digestauth.rb
|
||||||
|
|
|
@ -7,6 +7,10 @@ module RSS
|
||||||
include Utils
|
include Utils
|
||||||
|
|
||||||
def initialize(to_enc, from_enc=nil)
|
def initialize(to_enc, from_enc=nil)
|
||||||
|
if "".respond_to?(:encode)
|
||||||
|
@to_encoding = to_enc
|
||||||
|
return
|
||||||
|
end
|
||||||
normalized_to_enc = to_enc.downcase.gsub(/-/, '_')
|
normalized_to_enc = to_enc.downcase.gsub(/-/, '_')
|
||||||
from_enc ||= 'utf-8'
|
from_enc ||= 'utf-8'
|
||||||
normalized_from_enc = from_enc.downcase.gsub(/-/, '_')
|
normalized_from_enc = from_enc.downcase.gsub(/-/, '_')
|
||||||
|
@ -23,8 +27,12 @@ module RSS
|
||||||
end
|
end
|
||||||
|
|
||||||
def convert(value)
|
def convert(value)
|
||||||
|
if value.is_a?(String) and value.respond_to?(:encode)
|
||||||
|
value.encode(@to_encoding)
|
||||||
|
else
|
||||||
value
|
value
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def def_convert(depth=0)
|
def def_convert(depth=0)
|
||||||
instance_eval(<<-EOC, *get_file_and_line_from_caller(depth))
|
instance_eval(<<-EOC, *get_file_and_line_from_caller(depth))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue