sqlite-utils icon indicating copy to clipboard operation
sqlite-utils copied to clipboard

insert-files --text uses the locale encoding despite documenting a UTF-8 default

Open Mint0424 opened this issue 2 weeks ago • 0 comments

On main at 9c66bafa52ae23d40499c74b0db3b635bcddb876 (Python 3.12.13 on macOS), sqlite-utils insert-files --help says --encoding defaults to UTF-8. Importing a file from disk without that option instead uses Python's locale encoding. The standard input path already uses UTF-8 by default.

In a fresh directory with a POSIX shell:

printf '%s\n' 'São Paulo' > input.txt
LC_ALL=C PYTHONCOERCECLOCALE=0 PYTHONUTF8=0 \
  sqlite-utils insert-files example.db docs input.txt --text --silent

Expected: the command succeeds and the content_text column contains São Paulo.

Actual: the command exits with status 1 and reports an ASCII decoding error for the UTF-8 file. Passing --encoding utf-8 succeeds under the same locale.

Mint0424 avatar Nov 15 '26 23:11 Mint0424