Home

Awesome

elixir-mbcs

Wrapper for erlang-mbcs. This module provides functions for character encoding conversion.

Install

Adding the following to the mix.exs in your project:

defp deps do
  [
    {:elixir_mbcs, github: "woxtu/elixir-mbcs", tag: "0.1.3"},
  ]
end

Usage

# Start mbcs server
iex> Mbcs.start
:ok

# Convert UTF-8 to Shift_JIS
iex> Mbcs.encode!("九条カレン", :cp932)
<<139, 227, 143, 240, 131, 74, 131, 140, 131, 147>>

# Convert Shift_JIS to UTF-8, and return as a list
iex> Mbcs.decode!([139, 227, 143, 240, 131, 74, 131, 140, 131, 147], :cp932, return: :list)
[20061, 26465, 12459, 12524, 12531]

Support encodings

Options

License

Copyright (c) 2015 woxtu

Licensed under the MIT license.