Connection fails if database path contains multibyte characters (Say Chinese Characters)

Issue #100 invalid
Anonymous created an issue

Here is the line when I traced down the error:

conn = DriverManager.getConnection("jdbc:sqlite:" + dbFile);

if the file path of dbFile contains multibyte characters, say: C:\Users\测试\dbfile.db, the getConnection will fail and throw SqliteException.

Comments (5)

  1. kkyzivat_mosaic

    We have run into this issue as well. We have passed in the database pathname as UTF-8, however it's still failing on Windows 7.

    Are you sure you properly handle this on Windows?

    This is an especially big problem for any user account which has a Chinese character in it's name, which may be a very large (millions) number of affected users.

  2. Grace Batumbya


    Could you please provide your code that fails.

    I tried the following on my computer and it works.

    Connection con = DriverManager.getConnection("jdbc:sqlite:" + "c:\\temp\\测试\\test.db");
            Statement stmt = con.createStatement();
            stmt.executeUpdate("create table tbl(id, name)");
            stmt.executeUpdate("insert into tbl values (1, 'foo'), (2, 'bar')");
            ResultSet rs = stmt.executeQuery("select id, name from tbl");
            while (
                System.out.println("id: " + rs.getInt(1) + " name: "+ rs.getString(2));
  3. Log in to comment