Skip to content

Commit

Permalink
updated README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryochin committed Jan 1, 2024
1 parent ceed771 commit 3888156
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ You can achieve conversion to any desired encoding using [iconv](https://hex.pm/

```elixir
defmodule Converter do
@spec convert(binary, String.t()) :: {:ok, binary} | {:error, String.t()}
def convert(text, to_encoding \\ "UTF-8") do
case text |> CharsetDetect.guess do
case text |> String.slice(0, 1024) |> CharsetDetect.guess do
{:ok, ^to_encoding} ->
{:ok, text}
{:ok, encoding} ->
Expand Down

0 comments on commit 3888156

Please # to comment.