Created
April 28, 2019 02:39
-
-
Save mattsan/d41276836280f45fce8c029504b7690a to your computer and use it in GitHub Desktop.
文字列のエンコーディングの変換
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Conv do | |
def get(url) do | |
{:ok, response} = HTTPoison.get(url) | |
:iconv.convert("SJIS", "UTF-8", response.body) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Conv.MixProject do | |
use Mix.Project | |
def project do | |
[ | |
app: :conv, | |
version: "0.1.0", | |
elixir: "~> 1.8", | |
start_permanent: Mix.env() == :prod, | |
deps: deps() | |
] | |
end | |
def application do | |
[ | |
extra_applications: [:logger] | |
] | |
end | |
defp deps do | |
[ | |
{:iconv, "~> 1.0"}, # https://hex.pm/packages/iconv | |
{:httpoison, "~> 1.5"} | |
] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment