Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rkh/coder
Handle encodings, no matter the Ruby version, Operating System and installed libraries
https://github.com/rkh/coder
Last synced: 18 days ago
JSON representation
Handle encodings, no matter the Ruby version, Operating System and installed libraries
- Host: GitHub
- URL: https://github.com/rkh/coder
- Owner: rkh
- License: mit
- Created: 2012-09-21T10:14:56.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2023-12-08T20:45:59.000Z (11 months ago)
- Last Synced: 2024-10-14T19:42:48.159Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 28.3 KB
- Stars: 64
- Watchers: 8
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Coder
A Ruby library to deal with encodings, no matter if you're on 1.8 or 1.9, JRuby
or Rubinius, if you have a working iconv or not, it chooses the best way for you
to handle String encodings.## Usage
At the moment, Coder only cleans strings for you. I plan to add string
conversion and encoding detection later.### Cleaning Strings
``` ruby
clean_string = Coder.clean(dirty_string)
```You can also specify the encoding:
``` ruby
clean_string = Coder.clean(dirty_string, 'UTF-8')
```You can also modify a string in-place:
``` ruby
Coder.clean! some_string
```## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request