-
Notifications
You must be signed in to change notification settings - Fork 23
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
encoding issues on MSWin32 #52
Comments
10:30 @haarg ether: i'd recommend testing output separate from arguments |
For this script:
12:20 @Mithaldu ether: looks like the first one gets double, the second one triple-encoded EDIT: |
12:24 < ether> you've got the configs as described here? http://ox.no/posts/how-to-combine-git-windows-and-non-ascii-letters -- as utf-8 ? |
|
12:49 @Mithaldu i stepped through it |
and here's meep.pl: https://gist.github.com/wchristian/568af93e0669d488fc66 |
I used procmon to see what is actually being executed, and it turns out that perl does this:
While running a git commit via cmd directly runs this:
|
To expand in an explanatory manner on the last post: It proves fairly clearly that the issue lies in how Perl creates the process, not in how git itself processes the input. |
see genehack/Git-Wrapper#52 for the rending of sackcloth, gnashing of teeth, and otherwise lengthy tale of woe
- basic tests are now ascii-only; unicode tests are marked as TODO on MSWin32 for now (see (github) genehack/Git-Wrapper#52 for the gory details) - now properly sorting names using case-insensitive unicode collation
@karenetheridge could you try the fix in the https://github.com/genehack/Git-Wrapper/tree/unicrap branch? I could replicate the encoding error (i.e., t/unicrap.t would fail) but setting the explicit encoding on all the open3 filehandles works. |
@genehack yup, your change in the unicrap branch accounts for the mojibake... but it doesn't explain the strangeness I was seeing: in perl 5.12 and above, I get back sane results from Git::Wrapper no matter whether the string passed is encoded or not! (The good/bad versions of IPC::Open3 here are 1.04 adn 1.05, and there are very minimal differences between these versions, so I surmise it must be something in perl itself that changed.) I'm also uncertain whether GW should be automatically binmode'ing stdin/stdout/stderr automatically -- e.g. there are config settings such as i18n.logoutputencoding which can be set to another encoding. |
I would really like to close this issue. @karenetheridge : I don't completely understand your previous comment about 5.12 and above. I'm happy to port over to Capture::Tiny in a branch if that seems like it would solve the problem (or even if it just seems like it's worth testing against), but that's going to require bumping the min Perl up to 5.8.1 (by my reading of Capture::Tiny's docs, anyway). G::W currently works all the way back to 5.6. Maybe it's time ... |
@karenetheridge @wchristian I just pushed a branch that uses (a pretty rapid and naïve port to) |
would that be..?
We should see some smoke results by tomorrow. whee! |
I pulled the "author=ilmari" test out of the old |
I don't think there's any good reason to switch to Capture::Tiny. It offers no real advantages over IPC::Open3 for this use case, and it won't fix the problem anyway. From what I can see, it is impossible for perl to provide unicode command line arguments in any way that Git will understand without using something like Win32::Unicode::Process. |
|
here's an example test: http://www.cpantesters.org/cpan/report/12ed2af8-6bf4-1014-8695-9e662ad63fef
the test: https://metacpan.org/source/ETHER/Dist-Zilla-Plugin-Git-Contributors-0.004/t/01-basic.t#L50
and the prep work done for MSWin32: https://metacpan.org/source/ETHER/Dist-Zilla-Plugin-Git-Contributors-0.004/t/lib/GitSetup.pm#L37
sadly, this doesn't seem to be enough. But I'm not sure what's missing.
The text was updated successfully, but these errors were encountered: