Giter Club home page Giter Club logo

mbcs_rs's Introduction

MbcsRs

Build Status

Charactor encoding support for Elixir. using ruster & "rust-encoding" crate. (Shift-JIS, EUC-JP, Big5.. other WHATWG encoding)

Installation

If available in Hex, the package can be installed by adding mbcs_rs to your list of dependencies in mix.exs:

def deps do
  [
    {:mbcs_rs, "~> 0.1"}
  ]
end

Usage:

iex> MbcsRs.encode!("日本語", "SJIS") |> MbcsRs.decode!("SJIS")
日本語

iex> MbcsRs.encode!("你好,世界", "BIG5") |> MbcsRs.decode!("BIG5") 
"你好,世界"

iex> MbcsRs.encode!("한국어", "EUC-KR") |> MbcsRs.decode!("EUC-KR")
"한국어"

iex> File.stream!("KEN_ALL.CSV") \
 |> Stream.map(&MbcsRs.decode!(&1,"SJIS")) \
 |> Stream.filter(&String.contains?(&1,"福岡市**区")) \
 |> Enum.to_list
["40133,\"810  \",\"8100000\",\"フクオカケン\",\"フクオカシチユウオウク\",\"イカニケイサイガナイバアイ\",\"福岡県\",\"福岡市**区\",\"以下に掲載がない場合\",0,0,0,0,0,0\n",
...
 "40133,\"810  \",\"8100037\",\"フクオカケン\",\"フクオカシチユウオウク\",\"ミナミコウエン\",\"福岡県\",\"福岡市**区\",\"南公園\",0,0,0,0,0,0\n",
 "40133,\"810  \",\"8100022\",\"フクオカケン\",\"フクオカシチユウオウク\",\"ヤクイン\",\"福岡県\",\"福岡市**区\",\"薬院\",0,0,1,0,0,0\n",
 ...]

Supporting Other Encodings. See WHATWG encoding spec

requirement

Rust compiler & cargo

example for alpine linux

apk add musl-dev rust cargo 

mbcs_rs's People

Contributors

enpedasi avatar pulzzedavid avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.