diff --git a/c_src/sqlite3_nif.c b/c_src/sqlite3_nif.c index af1259c..2658c5e 100644 --- a/c_src/sqlite3_nif.c +++ b/c_src/sqlite3_nif.c @@ -204,7 +204,7 @@ exqlite_open(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) return enif_make_badarg(env); } - size = enif_get_string(env, argv[0], filename, MAX_PATHNAME, ERL_NIF_LATIN1); + size = enif_get_string(env, argv[0], filename, MAX_PATHNAME, ERL_NIF_UTF8); if (size <= 0) { return make_error_tuple(env, "invalid_filename"); } diff --git a/test/exqlite/connection_test.exs b/test/exqlite/connection_test.exs index 3669380..b733733 100644 --- a/test/exqlite/connection_test.exs +++ b/test/exqlite/connection_test.exs @@ -46,6 +46,16 @@ defmodule Exqlite.ConnectionTest do assert state.db end + test "connects to a file with an accented character" do + path = Temp.path!(prefix: "databasé") + {:ok, state} = Connection.connect(database: path) + + assert state.path == path + assert state.db + + File.rm(path) + end + test "fails to write a file from URL with mode=ro" do path = Temp.path!()