Fix encoding problem with comprehensive tests#68
Merged
Conversation
Owner
Author
|
This addresses the encoding issue reported in PR #52 where CSV files encoded in Latin-1/ISO-8859-1 couldn't be processed because the default encoding was hardcoded as UTF-8. Changes: - Add --encoding option to specify character encoding for CSV files - Modify build_csv_convert_string() to accept and use the encoding parameter - Add validation that --encoding requires --csv or --dialect - Add comprehensive tests for Latin-1, ISO-8859-1, and UTF-16 encodings - Document --encoding option in README
7a571a9 to
bea5847
Compare
Owner
Author
Owner
Author
|
In manually testing this I found this didn't work: cd /tmp && mkdir -p encoding-demo && cd encoding-demo
git init
printf 'id,name,city\n1,José,São Paulo\n2,François,Montréal\n3,Müller,München\n' | iconv -f UTF-8 -t ISO-8859-1 > places.csv
git add places.csv && git commit -m "Add places data"Then from my uv run git-history file places.db places.csv --csv --id id --encoding latin-1 --repo /tmp/encoding-demoGave an error:
|
Owner
Author
simonw
added a commit
that referenced
this pull request
Dec 21, 2025
simonw
added a commit
that referenced
this pull request
Dec 21, 2025
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.

This addresses the encoding issue reported in PR #52 where CSV files encoded in Latin-1/ISO-8859-1 couldn't be processed because the default encoding was hardcoded as UTF-8.
Changes: