Draft
Fix tethys db configure UTF8 encoding error on Windows#1280
tethys db configure UTF8 encoding error on Windows#1280Conversation
Copilot
AI
changed the title
Fix
Fix Jun 16, 2026
tethys db configure encoding error on Windows (issue #1250)tethys db configure UTF8 encoding error on Windows
Copilot created this pull request from a session on behalf of
swainn
June 16, 2026 16:04
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Windows, PostgreSQL initializes
template1with the OS locale encoding (e.g.WIN1252).createdb -E utf-8fails because UTF8 is incompatible with aWIN1252-encoded template. The fix is to usetemplate0, which is always encoding-agnostic.Changes Made to Code
tethys_cli/db_commands.py: Added--template template0to thecreatedbinvocation increate_db_user()so database creation succeeds regardless of the server's locale encoding.tests/unit_tests/test_tethys_cli/test_db_commands.py: Updatedtest_db_command_create_db_userto assert--template template0is passed tocreatedb.Related PRs, Issues, and Discussions
tethys db configurefails on Windows w/encoding error #1250Additional Notes
template0is PostgreSQL's pristine, unmodified template and is the recommended approach when specifying a non-default encoding (per PostgreSQL docs and the error hint in the original bug report).Quality Checks