Skip to content

Fix tethys db configure UTF8 encoding error on Windows#1280

Draft
swainn with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-issue-1250
Draft

Fix tethys db configure UTF8 encoding error on Windows#1280
swainn with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-issue-1250

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

On Windows, PostgreSQL initializes template1 with the OS locale encoding (e.g. WIN1252). createdb -E utf-8 fails because UTF8 is incompatible with a WIN1252-encoded template. The fix is to use template0, which is always encoding-agnostic.

Changes Made to Code

  • tethys_cli/db_commands.py: Added --template template0 to the createdb invocation in create_db_user() so database creation succeeds regardless of the server's locale encoding.
  • tests/unit_tests/test_tethys_cli/test_db_commands.py: Updated test_db_command_create_db_user to assert --template template0 is passed to createdb.

Related PRs, Issues, and Discussions

Additional Notes

  • template0 is 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

  • At least one new test has been written for new code
  • New code has 100% test coverage
  • Code has been formatted with Black
  • Code has been linted with flake8
  • Docstrings for new methods have been added
  • The documentation has been updated appropriately

Copilot AI changed the title Fix tethys db configure encoding error on Windows (issue #1250) Fix tethys db configure UTF8 encoding error on Windows Jun 16, 2026
Copilot AI requested a review from swainn June 16, 2026 16:04
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — copilot/fix-issue-1250 into main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants