Skip to content
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

Proper Unicode handling in port process output #2212

Merged
merged 1 commit into from
Jan 26, 2020

Conversation

ferd
Copy link
Collaborator

@ferd ferd commented Jan 25, 2020

The problem is that the shell util handlers receive a byte stream, which
we handle as a list coming from a port. However the byte stream is utf-8
encoded in most systems, which breaks encoding expectations (binaries
only) for Erlang.

This patch turns the list of characters to a binary for all shell calls,
before re-encoding it properly as unicode lists to keep the format compatible.

Fixes #2205

The problem is that the shell util handlers receive a byte stream, which
we handle as a list coming from a port. However the byte stream is utf-8
encoded in most systems, which breaks encoding expectations (binaries
only) for Erlang.

This patch turns the list of characters to a binary for all shell calls,
before re-encoding it properly as unicode lists to keep the format compatible.

Fixes erlang#2205
@ferd ferd assigned tsloughter and unassigned tsloughter Jan 25, 2020
@ferd ferd requested a review from tsloughter January 25, 2020 01:25
@ferd
Copy link
Collaborator Author

ferd commented Jan 25, 2020

@lpil if you want to double-check it

@lpil
Copy link

lpil commented Jan 25, 2020

Great stuff, thank you. I'll take a look as soon as I can, though may not be until tomorrow or Monday as I'm currently traveling

@lpil
Copy link

lpil commented Jan 26, 2020

Works perfectly! Thank you! :)

@lpil
Copy link

lpil commented Jan 19, 2021

Hi gang, did this ever get released? I still have the same problem.

@ferd
Copy link
Collaborator Author

ferd commented Jan 19, 2021

Yeah it was released and I don't believe it was changed after the fact. Might need to go bisect to find which version reverted the change.

@lpil
Copy link

lpil commented Jan 19, 2021

Thank you. Would you like me to make another PR with these changes?

@ferd
Copy link
Collaborator Author

ferd commented Jan 19, 2021

Yeah if you feel like making the fix I'd be glad to review and get it through.

@lpil
Copy link

lpil commented Jan 19, 2021

Sorry @ferd I was looking at your repo rather than this one by mistake and thought that the patch had got lost in a bad rebase or similar. I don't know what the issue is and I'm too busy to dig into it properly.

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.

rebar3 incorrectly printing stdout from rebar_utils:sh/pre_hook command
3 participants