-
Notifications
You must be signed in to change notification settings - Fork 4
fix: loading utf-8 file when locale encoding is set to ascii #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| tests = | ||
| [ testCase "read-simple" $ readTest "simple.cfg" | ||
| , testCase "read-pathological" $ readTest "pathological.cfg" | ||
| , testCase "read-utf-8-with-ascii-locale" $ readTestWithLocale "utf-8.cfg" E.ascii |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Prior to the change, did this one fail with:
hGetContents: invalid argument (cannot decode byte sequence starting from ..
Same as PostgREST/postgrest#4379 (comment)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly! If I remove this change and re-run tests, I get:
read-utf-8-with-ascii-locale: [Failed]
ERROR: tests/resources/utf-8.cfg: hGetContents: invalid argument (cannot decode byte sequence starting from 195)
EDIT: A couple other tests slightly change in output, so I modified accordingly.
Configurator-pg fails to load UTF-8 encoded files when the locale settings are set to ASCII chars. This commit fixes this by using a safer and faster UTF-8 decoding when reading files. See: PostgREST/postgrest#4386 (comment) for more info on this. Signed-off-by: Taimoor Zaeem <[email protected]>
8cac77f to
0a9f4c5
Compare
steve-chavez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work 🥇
|
@laurenceisla I saw you did a release previously, could you make a new release for this fix? 🙏 |
Yup, will do. |
Configurator-pg fails to load UTF-8 encoded files when the locale settings are set to ASCII chars. This commit fixes this by using a safer and faster UTF-8 decoding when reading files.
See: PostgREST/postgrest#4386 (comment) for more info on this.