encoding_name

Version, currently 0.11 version
  • 0.1latestFeb 27, 2017

github.com/kostya/encoding_name

Normalizer of encoding name for Crystal (to use it in crystal internal encoder-decoder)

4 stars
1 dependent
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  encoding_name:
    github: kostya/encoding_name
    version: ~> 0.1

Then run:

shards install

shard.yml

Crystal
no constraint declared
License
MIT
Author
Konstantin Makarchev <kostya27@gmail.com>

Dependencies

Runtime Dependencies

README

# EncodingName

Normalizer of encoding name for Crystal (to use it in crystal internal encoder-decoder)

## Installation


Add this to your application's `shard.yml`:

```yaml
dependencies:
  encoding_name:
    github: kostya/encoding_name
```


## Usage


```crystal
require "encoding_name"

p EncodingName.new("cp-1251").normalize
# => "CP1251"
p EncodingName.new("Windows 1251").normalize
# => "CP1251"
p EncodingName.new("uft8", find_similar: true).normalize
# => "UTF-8"
p EncodingName.new("Unicode").normalize
# => "UTF-8"
p EncodingName.new("asdfdsaf").normalize
# => nil

```