Class: RSS::Converter (Ruby 2.3.2)
Description: Class : RSS::Converter - Ruby 2.3.2

- Home
- Core 2.3.2
- Std-lib 2.3.2
- Downloads

Support for the Ruby 2.3 series has ended. See here for reference.

### Home Classes Methods

### In Files

- rss/converter.rb

### Parent

Object

### Methods

- ::new
- #convert
- #def_convert
- #def_else_enc
- #def_iconv_convert
- #def_same_enc
- #def_to_euc_jp_from_iso_2022_jp
- #def_to_euc_jp_from_shift_jis
- #def_to_euc_jp_from_utf_8
- #def_to_iso_2022_jp_from_euc_jp
- #def_to_iso_8859_1_from_utf_8
- #def_to_shift_jis_from_euc_jp
- #def_to_shift_jis_from_utf_8
- #def_to_utf_8_from_euc_jp
- #def_to_utf_8_from_iso_8859_1
- #def_to_utf_8_from_shift_jis
- #def_uconv_convert_if_can

### Included Modules

- RSS::Utils

### Class/Module Index

Quicksearch

- RSS
- RSS::Atom
- RSS::Atom::CommonModel
- RSS::Atom::ContentModel
- RSS::Atom::ContentModel::ClassMethods
- RSS::Atom::DateConstruct
- RSS::Atom::DuplicateLinkChecker
- RSS::Atom::Entry
- RSS::Atom::Feed
- RSS::Atom::Feed::Author
- RSS::Atom::Feed::Category
- RSS::Atom::Feed::Contributor
- RSS::Atom::Feed::Entry
- RSS::Atom::Feed::Entry::Content
- RSS::Atom::Feed::Entry::Published
- RSS::Atom::Feed::Entry::Source
- RSS::Atom::Feed::Entry::Summary
- RSS::Atom::Feed::Generator
- RSS::Atom::Feed::Icon
- RSS::Atom::Feed::Id
- RSS::Atom::Feed::Link
- RSS::Atom::Feed::Logo
- RSS::Atom::Feed::Rights
- RSS::Atom::Feed::Subtitle
- RSS::Atom::Feed::Title
- RSS::Atom::Feed::Updated
- RSS::Atom::PersonConstruct
- RSS::Atom::PersonConstruct::Email
- RSS::Atom::PersonConstruct::Name
- RSS::Atom::PersonConstruct::Uri
- RSS::Atom::TextConstruct
- RSS::Atom::URIContentModel
- RSS::BaseDublinCoreModel
- RSS::BaseListener
- RSS::BaseModel
- RSS::BaseParser
- RSS::ContentModel
- RSS::ConversionError
- RSS::Converter
- RSS::DublinCoreModel
- RSS::DublincoreModel
- RSS::Element
- RSS::Error
- RSS::ITunesBaseModel
- RSS::ITunesChannelModel
- RSS::ITunesChannelModel::ITunesCategory
- RSS::ITunesChannelModel::ITunesImage
- RSS::ITunesChannelModel::ITunesOwner
- RSS::ITunesItemModel
- RSS::ITunesItemModel::ITunesDuration
- RSS::ITunesModelUtils
- RSS::ImageFaviconModel
- RSS::ImageFaviconModel::ImageFavicon
- RSS::ImageItemModel
- RSS::ImageItemModel::ImageItem
- RSS::ImageModelUtils
- RSS::InvalidRSSError
- RSS::ListenerMixin
- RSS::Maker
- RSS::Maker::Atom
- RSS::Maker::Atom::Entry
- RSS::Maker::Atom::Entry::Channel
- RSS::Maker::Atom::Entry::Channel::Cloud
- RSS::Maker::Atom::Entry::Channel::Description
- RSS::Maker::Atom::Entry::Channel::Generator
- RSS::Maker::Atom::Entry::Channel::SkipDays
- RSS::Maker::Atom::Entry::Channel::SkipDays::Day
- RSS::Maker::Atom::Entry::Channel::SkipHours
- RSS::Maker::Atom::Entry::Channel::SkipHours::Hour
- RSS::Maker::Atom::Entry::Image
- RSS::Maker::Atom::Entry::Items
- RSS::Maker::Atom::Entry::Items::Item
- RSS::Maker::Atom::Entry::Textinput
- RSS::Maker::Atom::Feed
- RSS::Maker::Atom::Feed::Channel
- RSS::Maker::Atom::Feed::Channel::Categories
- RSS::Maker::Atom::Feed::Channel::Categories::Category
- RSS::Maker::Atom::Feed::Channel::Cloud
- RSS::Maker::Atom::Feed::Channel::Generator
- RSS::Maker::Atom::Feed::Channel::Links
- RSS::Maker::Atom::Feed::Channel::Links::Link
- RSS::Maker::Atom::Feed::Channel::SkipDays
- RSS::Maker::Atom::Feed::Channel::SkipDays::Day
- RSS::Maker::Atom::Feed::Channel::SkipHours
- RSS::Maker::Atom::Feed::Channel::SkipHours::Hour
- RSS::Maker::Atom::Feed::Image
- RSS::Maker::Atom::Feed::Items
- RSS::Maker::Atom::Feed::Items::Item
- RSS::Maker::Atom::Feed::Items::Item::Categories
- RSS::Maker::Atom::Feed::Items::Item::Categories::Category
- RSS::Maker::Atom::Feed::Items::Item::Content
- RSS::Maker::Atom::Feed::Items::Item::Enclosure
- RSS::Maker::Atom::Feed::Items::Item::Guid
- RSS::Maker::Atom::Feed::Items::Item::Links
- RSS::Maker::Atom::Feed::Items::Item::Links::Link
- RSS::Maker::Atom::Feed::Items::Item::Source
- RSS::Maker::Atom::Feed::Items::Item::Source::Categories
- RSS::Maker::Atom::Feed::Items::Item::Source::Categories::Category
- RSS::Maker::Atom::Feed::Items::Item::Source::Generator
- RSS::Maker::Atom::Feed::Items::Item::Source::Icon
- RSS::Maker::Atom::Feed::Items::Item::Source::Links
- RSS::Maker::Atom::Feed::Items::Item::Source::Links::Link
- RSS::Maker::Atom::Feed::Items::Item::Source::Logo
- RSS::Maker::Atom::Feed::Textinput
- RSS::Maker::AtomCategory
- RSS::Maker::AtomGenerator
- RSS::Maker::AtomLink
- RSS::Maker::AtomLogo
- RSS::Maker::AtomPersonConstructBase
- RSS::Maker::AtomPersons
- RSS::Maker::AtomTextConstruct
- RSS::Maker::AtomTextConstructBase
- RSS::Maker::AtomTextConstructBase::EnsureXMLContent
- RSS::Maker::Base
- RSS::Maker::ChannelBase
- RSS::Maker::ChannelBase::AuthorsBase
- RSS::Maker::ChannelBase::AuthorsBase::AuthorBase
- RSS::Maker::ChannelBase::CategoriesBase
- RSS::Maker::ChannelBase::CategoriesBase::CategoryBase
- RSS::Maker::ChannelBase::CloudBase
- RSS::Maker::ChannelBase::ContributorsBase
- RSS::Maker::ChannelBase::ContributorsBase::ContributorBase
- RSS::Maker::ChannelBase::CopyrightBase
- RSS::Maker::ChannelBase::DescriptionBase
- RSS::Maker::ChannelBase::GeneratorBase
- RSS::Maker::ChannelBase::ITunesCategories
- RSS::Maker::ChannelBase::ITunesCategories::ITunesCategory
- RSS::Maker::ChannelBase::ITunesImage
- RSS::Maker::ChannelBase::ITunesOwner
- RSS::Maker::ChannelBase::LinksBase
- RSS::Maker::ChannelBase::LinksBase::LinkBase
- RSS::Maker::ChannelBase::SkipDaysBase
- RSS::Maker::ChannelBase::SkipDaysBase::DayBase
- RSS::Maker::ChannelBase::SkipHoursBase
- RSS::Maker::ChannelBase::SkipHoursBase::HourBase
- RSS::Maker::ChannelBase::TitleBase
- RSS::Maker::ContentModel
- RSS::Maker::DublinCoreModel
- RSS::Maker::ITunesBaseModel
- RSS::Maker::ITunesChannelModel
- RSS::Maker::ITunesChannelModel::ITunesCategoriesBase
- RSS::Maker::ITunesChannelModel::ITunesCategoriesBase::ITunesCategoryBase
- RSS::Maker::ITunesChannelModel::ITunesImageBase
- RSS::Maker::ITunesChannelModel::ITunesOwnerBase
- RSS::Maker::ITunesItemModel
- RSS::Maker::ITunesItemModel::ITunesDurationBase
- RSS::Maker::ImageBase
- RSS::Maker::ImageFaviconModel
- RSS::Maker::ImageFaviconModel::ImageFaviconBase
- RSS::Maker::ImageItemModel
- RSS::Maker::ImageItemModel::ImageItemBase
- RSS::Maker::ItemsBase
- RSS::Maker::ItemsBase::ItemBase
- RSS::Maker::ItemsBase::ItemBase::ContentBase
- RSS::Maker::ItemsBase::ItemBase::DescriptionBase
- RSS::Maker::ItemsBase::ItemBase::EnclosureBase
- RSS::Maker::ItemsBase::ItemBase::GuidBase
- RSS::Maker::ItemsBase::ItemBase::ITunesDuration
- RSS::Maker::ItemsBase::ItemBase::RightsBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::IconBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::LogoBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::RightsBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::SubtitleBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::TitleBase
- RSS::Maker::ItemsBase::ItemBase::TitleBase
- RSS::Maker::RSS09
- RSS::Maker::RSS091
- RSS::Maker::RSS091::Channel
- RSS::Maker::RSS091::Image
- RSS::Maker::RSS091::Items
- RSS::Maker::RSS091::Items::Item
- RSS::Maker::RSS091::Textinput
- RSS::Maker::RSS092
- RSS::Maker::RSS092::Channel
- RSS::Maker::RSS092::Image
- RSS::Maker::RSS092::Items
- RSS::Maker::RSS092::Items::Item
- RSS::Maker::RSS092::Textinput
- RSS::Maker::RSS09::Channel
- RSS::Maker::RSS09::Channel::Authors
- RSS::Maker::RSS09::Channel::Authors::Author
- RSS::Maker::RSS09::Channel::Categories
- RSS::Maker::RSS09::Channel::Categories::Category
- RSS::Maker::RSS09::Channel::Cloud
- RSS::Maker::RSS09::Channel::Contributors
- RSS::Maker::RSS09::Channel::Contributors::Contributor
- RSS::Maker::RSS09::Channel::Copyright
- RSS::Maker::RSS09::Channel::Description
- RSS::Maker::RSS09::Channel::Generator
- RSS::Maker::RSS09::Channel::Links
- RSS::Maker::RSS09::Channel::Links::Link
- RSS::Maker::RSS09::Channel::SkipDays
- RSS::Maker::RSS09::Channel::SkipDays::Day
- RSS::Maker::RSS09::Channel::SkipHours
- RSS::Maker::RSS09::Channel::SkipHours::Hour
- RSS::Maker::RSS09::Channel::Title
- RSS::Maker::RSS09::Image
- RSS::Maker::RSS09::Items
- RSS::Maker::RSS09::Items::Item
- RSS::Maker::RSS09::Items::Item::Authors
- RSS::Maker::RSS09::Items::Item::Authors::Author
- RSS::Maker::RSS09::Items::Item::Categories
- RSS::Maker::RSS09::Items::Item::Categories::Category
- RSS::Maker::RSS09::Items::Item::Content
- RSS::Maker::RSS09::Items::Item::Contributors
- RSS::Maker::RSS09::Items::Item::Contributors::Contributor
- RSS::Maker::RSS09::Items::Item::Description
- RSS::Maker::RSS09::Items::Item::Enclosure
- RSS::Maker::RSS09::Items::Item::Guid
- RSS::Maker::RSS09::Items::Item::Links
- RSS::Maker::RSS09::Items::Item::Links::Link
- RSS::Maker::RSS09::Items::Item::Rights
- RSS::Maker::RSS09::Items::Item::Source
- RSS::Maker::RSS09::Items::Item::Source::Authors
- RSS::Maker::RSS09::Items::Item::Source::Authors::Author
- RSS::Maker::RSS09::Items::Item::Source::Categories
- RSS::Maker::RSS09::Items::Item::Source::Categories::Category
- RSS::Maker::RSS09::Items::Item::Source::Contributors
- RSS::Maker::RSS09::Items::Item::Source::Contributors::Contributor
- RSS::Maker::RSS09::Items::Item::Source::Generator
- RSS::Maker::RSS09::Items::Item::Source::Icon
- RSS::Maker::RSS09::Items::Item::Source::Links
- RSS::Maker::RSS09::Items::Item::Source::Links::Link
- RSS::Maker::RSS09::Items::Item::Source::Logo
- RSS::Maker::RSS09::Items::Item::Source::Rights
- RSS::Maker::RSS09::Items::Item::Source::Subtitle
- RSS::Maker::RSS09::Items::Item::Source::Title
- RSS::Maker::RSS09::Items::Item::Title
- RSS::Maker::RSS09::Textinput
- RSS::Maker::RSS10
- RSS::Maker::RSS10::Channel
- RSS::Maker::RSS10::Channel::Authors
- RSS::Maker::RSS10::Channel::Authors::Author
- RSS::Maker::RSS10::Channel::Categories
- RSS::Maker::RSS10::Channel::Categories::Category
- RSS::Maker::RSS10::Channel::Cloud
- RSS::Maker::RSS10::Channel::Contributors
- RSS::Maker::RSS10::Channel::Contributors::Contributor
- RSS::Maker::RSS10::Channel::Copyright
- RSS::Maker::RSS10::Channel::Description
- RSS::Maker::RSS10::Channel::Generator
- RSS::Maker::RSS10::Channel::Links
- RSS::Maker::RSS10::Channel::Links::Link
- RSS::Maker::RSS10::Channel::SkipDays
- RSS::Maker::RSS10::Channel::SkipDays::Day
- RSS::Maker::RSS10::Channel::SkipHours
- RSS::Maker::RSS10::Channel::SkipHours::Hour
- RSS::Maker::RSS10::Channel::Title
- RSS::Maker::RSS10::Image
- RSS::Maker::RSS10::Items
- RSS::Maker::RSS10::Items::Item
- RSS::Maker::RSS10::Items::Item::Authors
- RSS::Maker::RSS10::Items::Item::Authors::Author
- RSS::Maker::RSS10::Items::Item::Categories
- RSS::Maker::RSS10::Items::Item::Categories::Category
- RSS::Maker::RSS10::Items::Item::Content
- RSS::Maker::RSS10::Items::Item::Contributors
- RSS::Maker::RSS10::Items::Item::Contributors::Contributor
- RSS::Maker::RSS10::Items::Item::Description
- RSS::Maker::RSS10::Items::Item::Enclosure
- RSS::Maker::RSS10::Items::Item::Guid
- RSS::Maker::RSS10::Items::Item::Links
- RSS::Maker::RSS10::Items::Item::Links::Link
- RSS::Maker::RSS10::Items::Item::Rights
- RSS::Maker::RSS10::Items::Item::Source
- RSS::Maker::RSS10::Items::Item::Source::Authors
- RSS::Maker::RSS10::Items::Item::Source::Authors::Author
- RSS::Maker::RSS10::Items::Item::Source::Categories
- RSS::Maker::RSS10::Items::Item::Source::Categories::Category
- RSS::Maker::RSS10::Items::Item::Source::Contributors
- RSS::Maker::RSS10::Items::Item::Source::Contributors::Contributor
- RSS::Maker::RSS10::Items::Item::Source::Generator
- RSS::Maker::RSS10::Items::Item::Source::Icon
- RSS::Maker::RSS10::Items::Item::Source::Links
- RSS::Maker::RSS10::Items::Item::Source::Links::Link
- RSS::Maker::RSS10::Items::Item::Source::Logo
- RSS::Maker::RSS10::Items::Item::Source::Rights
- RSS::Maker::RSS10::Items::Item::Source::Subtitle
- RSS::Maker::RSS10::Items::Item::Source::Title
- RSS::Maker::RSS10::Items::Item::Title
- RSS::Maker::RSS10::Textinput
- RSS::Maker::RSS20
- RSS::Maker::RSS20::Channel
- RSS::Maker::RSS20::Channel::Categories
- RSS::Maker::RSS20::Channel::Categories::Category
- RSS::Maker::RSS20::Channel::Cloud
- RSS::Maker::RSS20::Channel::Generator
- RSS::Maker::RSS20::Channel::SkipDays
- RSS::Maker::RSS20::Channel::SkipDays::Day
- RSS::Maker::RSS20::Channel::SkipHours
- RSS::Maker::RSS20::Channel::SkipHours::Hour
- RSS::Maker::RSS20::Image
- RSS::Maker::RSS20::Items
- RSS::Maker::RSS20::Items::Item
- RSS::Maker::RSS20::Items::Item::Authors
- RSS::Maker::RSS20::Items::Item::Authors::Author
- RSS::Maker::RSS20::Items::Item::Categories
- RSS::Maker::RSS20::Items::Item::Categories::Category
- RSS::Maker::RSS20::Items::Item::Enclosure
- RSS::Maker::RSS20::Items::Item::Guid
- RSS::Maker::RSS20::Items::Item::Source
- RSS::Maker::RSS20::Items::Item::Source::Links
- RSS::Maker::RSS20::Items::Item::Source::Links::Link
- RSS::Maker::RSS20::Textinput
- RSS::Maker::RSSBase
- RSS::Maker::SetupDefaultDate
- RSS::Maker::SetupDefaultLanguage
- RSS::Maker::SlashModel
- RSS::Maker::SyndicationModel
- RSS::Maker::TaxonomyTopicModel
- RSS::Maker::TaxonomyTopicModel::TaxonomyTopicsBase
- RSS::Maker::TaxonomyTopicModel::TaxonomyTopicsBase::TaxonomyTopicBase
- RSS::Maker::TaxonomyTopicsModel
- RSS::Maker::TaxonomyTopicsModel::TaxonomyTopicsBase
- RSS::Maker::TextinputBase
- RSS::Maker::TrackBackModel
- RSS::Maker::TrackBackModel::TrackBackAboutsBase
- RSS::Maker::TrackBackModel::TrackBackAboutsBase::TrackBackAboutBase
- RSS::Maker::XMLStyleSheets
- RSS::Maker::XMLStyleSheets::XMLStyleSheet
- RSS::MissingAttributeError
- RSS::MissingTagError
- RSS::NSError
- RSS::NotAvailableValueError
- RSS::NotExpectedTagError
- RSS::NotSetError
- RSS::NotValidXMLParser
- RSS::NotWellFormedError
- RSS::OverlappedPrefixError
- RSS::Parser
- RSS::RDF::Bag
- RSS::RDF::Bag::Li
- RSS::RDF::Channel
- RSS::RDF::Channel::Image
- RSS::RDF::Channel::Items
- RSS::RDF::Channel::Items::Seq
- RSS::RDF::Channel::Textinput
- RSS::RDF::Image
- RSS::RDF::Li
- RSS::RDF::Seq
- RSS::RDF::Seq::Li
- RSS::RDF::Textinput
- RSS::REXMLLikeXMLParser
- RSS::REXMLListener
- RSS::REXMLParser
- RSS::RSS09
- RSS::RSS10
- RSS::RootElementMixin
- RSS::Rss::Channel::Cloud
- RSS::Rss::Channel::Image
- RSS::Rss::Channel::Item::Category
- RSS::Rss::Channel::Item::Enclosure
- RSS::Rss::Channel::Item::Guid
- RSS::Rss::Channel::Item::Source
- RSS::Rss::Channel::SkipDays
- RSS::Rss::Channel::SkipDays::Day
- RSS::Rss::Channel::SkipHours
- RSS::Rss::Channel::SkipHours::Hour
- RSS::Rss::Channel::TextInput
- RSS::SetupMaker
- RSS::SlashModel
- RSS::SyndicationModel
- RSS::TaxonomyTopicModel
- RSS::TaxonomyTopicModel::TaxonomyTopic
- RSS::TaxonomyTopicsModel
- RSS::TaxonomyTopicsModel::TaxonomyTopics
- RSS::TaxonomyTopicsModel::TaxonomyTopics::Bag
- RSS::TooMuchTagError
- RSS::UnknownConversionMethodError
- RSS::UnknownTagError
- RSS::UnsupportedMakerVersionError
- RSS::Utils
- RSS::Utils::CSV
- RSS::Utils::InheritedReader
- RSS::Utils::YesCleanOther
- RSS::Utils::YesOther
- RSS::XML
- RSS::XML::Element
- RSS::XMLParserListener
- RSS::XMLParserNotFound
- RSS::XMLParserParser
- RSS::XMLScanListener
- RSS::XMLScanParser
- RSS::XMLStyleSheet
- RSS::XMLStyleSheetMixin
- Time
- XML
- XML::Parser
- XMLEncoding_ja
- XMLEncoding_ja::SJISHandler

No matching classes.

# RSS::Converter

### Public Class Methods

new(to_enc, from_enc=nil) click to toggle source

                   # File rss/converter.rb, line 9
    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(/-/, '_')
      if normalized_to_enc == normalized_from_enc
        def_same_enc()
      else
        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
      end
    end

### Public Instance Methods

convert(value) click to toggle source

                   # File rss/converter.rb, line 29
    def convert(value)
      if value.is_a?(String) and value.respond_to?(:encode)
        value.encode(@to_encoding)
      else
        value
      end
    end

def_convert(depth=0) click to toggle source

                   # File rss/converter.rb, line 37
        def def_convert(depth=0)
          instance_eval(<<-EOC, *get_file_and_line_from_caller(depth))
          def convert(value)
            if value.kind_of?(String)
              #{yield('value')}
            else
              value
            end
          end
          EOC
        end

def_else_enc(to_enc, from_enc) click to toggle source

                   # File rss/converter.rb, line 67
    def def_else_enc(to_enc, from_enc)
      def_iconv_convert(to_enc, from_enc, 0)
    end

def_iconv_convert(to_enc, from_enc, depth=0) click to toggle source

                   # File rss/converter.rb, line 49
        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
              begin
                @iconv.iconv(#{value})
              rescue Iconv::Failure
                raise ConversionError.new(#{value}, "#{to_enc}", "#{from_enc}")
              end
              EOC
            end
          rescue LoadError, ArgumentError, SystemCallError
            raise UnknownConversionMethodError.new(to_enc, from_enc)
          end
        end

def_same_enc() click to toggle source

                   # File rss/converter.rb, line 71
    def def_same_enc()
      def_convert do |value|
        value
      end
    end

def_to_euc_jp_from_iso_2022_jp() click to toggle source

                   # File rss/converter.rb, line 131
    def def_to_euc_jp_from_iso_2022_jp
      require "nkf"
      def_convert do |value|
        "NKF.nkf('-Je', #{value})"
      end
    end

def_to_euc_jp_from_shift_jis() click to toggle source

                   # File rss/converter.rb, line 117
    def def_to_euc_jp_from_shift_jis
      require "nkf"
      def_convert do |value|
        "NKF.nkf('-Se', #{value})"
      end
    end

def_to_euc_jp_from_utf_8() click to toggle source

                   # File rss/converter.rb, line 101
    def def_to_euc_jp_from_utf_8
      def_uconv_convert_if_can('u8toeuc', 'EUC-JP', 'UTF-8', '-We')
    end

def_to_iso_2022_jp_from_euc_jp() click to toggle source

                   # File rss/converter.rb, line 138
    def def_to_iso_2022_jp_from_euc_jp
      require "nkf"
      def_convert do |value|
        "NKF.nkf('-Ej', #{value})"
      end
    end

def_to_iso_8859_1_from_utf_8() click to toggle source

                   # File rss/converter.rb, line 151
        def def_to_iso_8859_1_from_utf_8
          def_convert do |value|
            <<-EOC
            array_utf8 = #{value}.unpack('U*')
            array_enc = []
            array_utf8.each do |num|
              if num <= 0xFF
                array_enc << num
              else
                array_enc.concat "&\#\#{num};".unpack('C*')
              end
            end
            array_enc.pack('C*')
            EOC
          end
        end

def_to_shift_jis_from_euc_jp() click to toggle source

                   # File rss/converter.rb, line 124
    def def_to_shift_jis_from_euc_jp
      require "nkf"
      def_convert do |value|
        "NKF.nkf('-Es', #{value})"
      end
    end

def_to_shift_jis_from_utf_8() click to toggle source

                   # File rss/converter.rb, line 109
    def def_to_shift_jis_from_utf_8
      def_uconv_convert_if_can('u8tosjis', 'Shift_JIS', 'UTF-8', '-Ws')
    end

def_to_utf_8_from_euc_jp() click to toggle source

                   # File rss/converter.rb, line 105
    def def_to_utf_8_from_euc_jp
      def_uconv_convert_if_can('euctou8', 'UTF-8', 'EUC-JP', '-Ew')
    end

def_to_utf_8_from_iso_8859_1() click to toggle source

                   # File rss/converter.rb, line 145
    def def_to_utf_8_from_iso_8859_1
      def_convert do |value|
        "#{value}.unpack('C*').pack('U*')"
      end
    end

def_to_utf_8_from_shift_jis() click to toggle source

                   # File rss/converter.rb, line 113
    def def_to_utf_8_from_shift_jis
      def_uconv_convert_if_can('sjistou8', 'UTF-8', 'Shift_JIS', '-Sw')
    end

def_uconv_convert_if_can(meth, to_enc, from_enc, nkf_arg) click to toggle source

                   # File rss/converter.rb, line 77
        def def_uconv_convert_if_can(meth, to_enc, from_enc, nkf_arg)
          begin
            require "uconv"
            def_convert(1) do |value|
              <<-EOC
              begin
                Uconv.#{meth}(#{value})
              rescue Uconv::Error
                raise ConversionError.new(#{value}, "#{to_enc}", "#{from_enc}")
              end
              EOC
            end
          rescue LoadError
            require 'nkf'
            if NKF.const_defined?(:UTF8)
              def_convert(1) do |value|
                "NKF.nkf(#{nkf_arg.dump}, #{value})"
              end
            else
              def_iconv_convert(to_enc, from_enc, 1)
            end
          end
        end