Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yury/gsm_encoder
ruby GSM 03.38 encoder/decoder
https://github.com/yury/gsm_encoder
Last synced: 24 days ago
JSON representation
ruby GSM 03.38 encoder/decoder
- Host: GitHub
- URL: https://github.com/yury/gsm_encoder
- Owner: yury
- Created: 2011-08-18T22:22:03.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2017-11-06T19:59:49.000Z (about 7 years ago)
- Last Synced: 2024-05-11T19:02:42.174Z (6 months ago)
- Language: Ruby
- Homepage:
- Size: 250 KB
- Stars: 16
- Watchers: 6
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
GSMEncoder encodes and decodes Ruby Strings to and from the SMS default
alphabet. It also supports the default extension table. The default alphabet
and it's extension table is defined in GSM 03.38This is port of Twitter's Java [implementation](https://github.com/twitter/cloudhopper-commons-charset/blob/master/src/main/java/com/cloudhopper/commons/charset/GSMCharset.java)
## Installation
__NOTE: ruby >= 1.9.2 is required__
gem install gsm_encoder
## Usage
require 'gsm_encoder'
# encoding
GSMEncoder.encode 'hello @ world' # => binary string
# decoding
GSMEncoder.decode(GSMEncoder.encode('hi')) # => 'hi'
# can encode?
GSMEncoder.can_encode?('`') # => false
# replaces unsupported chars with '?'
GSMEncoder.encode('`') # => '?'# replaces unsupported chars with a provided value ' '
GSMEncoder.encode('`', ' ') # => ' '## Updates
### 0.1.1
Added support for Spanish shift
### 0.1.2
Fixed bug when encoding line feed & carriage return
### 0.1.3
Adds the ability to provide the character used when encoding
unsupported strings### 0.1.4
Code cleanup and speedup
### 0.1.5
Even faster. About 4 times. Many thanks to @dlarrabee
### 0.1.7
Even faster! Many thanks to @ThomasSevestre