UriEncoding
Simple utility for URI encoding(URL encoding, percent encoding).
Installation
Add this line to your application's Gemfile:
gem 'uri_encoding'
And then execute:
$ bundle
Or install it yourself as:
$ gem install uri_encoding
Usage
Basic
UriEncoding.encode("Aa1!?_%") #=> "Aa1!?_%25"
UriEncoding.decode("Aa1!?_%25") #=> "Aa1!?_%"
Optional
UriEncoding.encode
receives exceptions for encoding.
UriEncoding.encode("Aa1!?_%", []) #=> "%41%61%31%21%3F%5F%25"
UriEncoding.encode("Aa1!?_%", UriEncoding::UnreservedCharacters) #=> "Aa1%21%3F_%25"
UriEncoding.decode
receives decoded string encoding.
string = UriEncoding.decode("%82%A0%82%A2%82%A4", Encoding::Windows_31J) #=> "あいう"
string.encoding #=> #<Encoding:Windows-31J>
Contributing
- Fork it ( https://github.com/[my-github-username]/uri_encoding/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request