hoodwink.d enhanced
 

juretta.com

Converting character sets | May 26, 2005-->

May 26, 2005
@hash.iconv!("iso-8859-1", "utf-8")
require 'iconv'
class Hash
    def iconv!(to,from)
        iconv = Iconv.new(to,from)
        perform_iconv!(iconv)
        iconv.close
    end

    def perform_iconv!(iconv)
        each_pair do |key,value|
            case value
                when String
                    self[key] = iconv.iconv(value)
                when Hash
                    value.perform_iconv!(iconv)
            end
        end
    end
end
@14:39 | Comments: 0 | Tags: Dropbox (35), Ruby (32)

Diggman

About

juretta.com is the personal workspace of Stefan Saasen. You can send him an email or read more about this site in the „About“ section.

« Previous entry

Setting the charset in a Rails App
posted over 3 years ago

» Next entry

Subversion Auto-Props in Eclipse
posted over 3 years ago

Recent comment

On: “Attachr.com: OpenID support added

You need to kill this spam stuff!

posted about 1 year ago by entropie

Look!

Latest links  RSS  

More...