Repository navigation
fix(cli): decode the server's code page in errors - #27
Merged
Merged
Conversation
A PostgreSQL with Russian lc_messages reports a failed login before the client encoding applies, so its text arrives in CP1251 inside an otherwise UTF-8 error. semibase printed the bytes as they came, and the site log Setup writes showed replacement characters where the reason should be. The error line now re-decodes each non-ASCII run that is not valid UTF-8 from the Windows ANSI code page; ASCII and valid UTF-8 pass unchanged, so an English server is unaffected. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mrcsin
force-pushed
the
decode-server-errors
branch
from
October 28, 2026 08:47
fdb4e88 to
1d49a63
Compare
mrcsin
marked this pull request as ready for review
October 28, 2026 08:47
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.
Problem
A PostgreSQL with Russian
lc_messagesreports a failed login before the client encoding applies, so its text arrives in CP1251 inside an otherwise UTF-8 error.semibaseprinted the bytes as they came, and the site log Setup writes showed replacement characters where the reason should be:Change
cmd/semibase/text.go:readableTextre-decodes each non-ASCII run of an error line that is not valid UTF-8; ASCII and valid UTF-8 pass unchanged, so an English server is unaffected.cmd/semibase/text_windows.go: the decoder is the Windows ANSI code page (GetACP+MultiByteToWideChar); other platforms keep the bytes.main.goapplies it to theerror:line ofsiteandbench;docs/architecture/installer.mdstates it beside theSitePasswordWrongrule.Verification
go test ./...(TestReadableText, andTestDecodeCodePagewith the real CP1251 bytes),golangci-lint run: 0 issues.lc_messages:SEMIBASE_SUPER_PASSWORD=<wrong> semibase benchnow writesfailed SASL auth: ВАЖНО: пользователь "postgres" не прошёл проверку подлинности (по паролю) (SQLSTATE 28P01).🤖 Generated with Claude Code