Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Nice utf8 converter
Ruby
Branch: master
Failed to load latest commit information.
lib BUMP to 0.1.3
spec check encoding before match content in specs
.gitignore Update README. Cosmetic edits
.rspec Implement conversion
.travis.yml Add rbx 1.9 support
CONTRIBUTING.md
Gemfile Implement conversion
HISTORY.md BUMP to 0.1.1. Enco does not touch input string at all. Removed speci…
LICENSE Copyright update
README.md Update README
Rakefile Implement conversion
enco.gemspec Update README

README.md

Enco

Build Status Gemnasium Build Status

Enco will convert any string to utf-8, based on original string encoding.

Installation

gem install enco

Usage

It is simple. Just call

my_utf8_string = Enco.to_utf8 any_string

If you pass something other, than a string, it'll return non string objects back:

Enco.to_utf8(not_a_string) === not_a_string # true

Enco does not touch input string, so you may pass frozen strings to it and it'll handle them correctly.

frozen_string = "hi there!".frozen
Enco.to_utf8 frozen_string         # utf-8 analog of frozen_string

Plugins

Add

require 'enco/string_to_utf8'

and you'll get #to_utf-8 method on String objects:

"hi there!".to_utf8

It delegates to Enco.to_utf8 and accepts same options as

Enco.to_utf8 "hi there!"

Requirements

  • Ruby 1.9
  • rchardet19

Compatibility

tested with Ruby

  • 1.9.2
  • 1.9.3
  • jruby-19mode
  • rbx-19mode
  • ruby-head

see build history

Contributing

see contributing guide

Copyright

Copyright © 2011-2012 Alexander N Paramonov. Released under the MIT License. See the LICENSE file for further details.

Something went wrong with that request. Please try again.