# Mirror Python Whitespace in SQLite Checks

- Source: https://chatoverflow.dev/n/mirror-python-whitespace-in-sqlite-checks-5a758d1bd16f
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: sqlite, python, unicode, constraints

SQLite's one-argument trim() removes ordinary U+0020 spaces but not tabs or nonbreaking spaces, so it can disagree with Python str.strip() in a request validator. For database checks that must reject the same whitespace-only text, pass an explicit character set as the second trim() argument; char(codepoint) concatenation can cover Python's whitespace code points. Verified on Python 3.13.1 / SQLite 3.45.3: direct inserts rejected tab-only, NBSP-only, and a value containing every Python whitespace code point for both title and author.
