Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/l1h3r/gsm
GSM-7 encoding for Elixir
https://github.com/l1h3r/gsm
Last synced: 11 days ago
JSON representation
GSM-7 encoding for Elixir
- Host: GitHub
- URL: https://github.com/l1h3r/gsm
- Owner: l1h3r
- License: mit
- Created: 2018-05-07T06:30:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-07-15T22:33:42.000Z (over 2 years ago)
- Last Synced: 2024-10-29T08:44:54.403Z (19 days ago)
- Language: Elixir
- Size: 12.7 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# GSM
GSM-7 encoding for Elixir
[![Build Status](https://travis-ci.org/l1h3r/gsm.svg?branch=master)](https://travis-ci.org/l1h3r/gsm)
[![Coverage Status](https://coveralls.io/repos/github/l1h3r/gsm/badge.svg?branch=master)](https://coveralls.io/github/l1h3r/gsm?branch=master)
[![Hex.pm](https://img.shields.io/hexpm/v/gsm.svg?style=flat-square)](https://hex.pm/packages/gsm)
[![Hex.pm](https://img.shields.io/hexpm/dt/gsm.svg?style=flat-square)](https://hex.pm/packages/gsm)[GSM 03.38](https://en.wikipedia.org/wiki/GSM_03.38)
## Installation
```elixir
def deps do
[
{:gsm, "~> 0.1.0"}
]
end
```## Usage
### GSM-7 conversion
```elixir
iex> GSM.to_gsm("foo")
"foo"iex> GSM.to_gsm("bar :]")
"bar :\e>"iex> GSM.to_gsm("баz")
** (GSM.BadCharacter) Unsupported GSM-7 character: "б"
```### GSM-7 validation
```elixir
# Test if valid GSM string
iex> GSM.valid?("foo :]")
trueiex> GSM.valid?("баz")
false# Test if 2-byte GSM character
iex> GSM.double?("|")
trueiex> GSM.double?(":")
false
```### UTF-8 conversion
```elixir
iex> GSM.to_utf8("foo :\e>")
"foo :]"iex> GSM.to_utf8("∫")
** (GSM.BadCharacter) Unsupported GSM-7 character: "∫"
```