ZSH on the left, Powershell on the right. Same machine..... why???
Asked
Active
Viewed 28 times
0

Zack A
- 688
- 5
- 11
-
Hello, please see here: https://stackoverflow.com/questions/49909629/unix-md5sum-vs-powershell-get-hash. Similar question has been answered. – Abraham Zinala Jun 02 '21 at 02:09
-
I already saw that, which is why I also included the configured encoding in the screenshot. That demonstrates that both shells are set to use the same encoding. So the article you reference is not in play as PS is NOT using UTF16. – Zack A Jun 02 '21 at 02:11
-
1In short: PowerShell encodes a string sent to an external program using the encoding stored in the `$OutputEncoding` preference variable and _invariably appends a trailing (platform-appropriate) newline_ - see [GitHub issue #5974](https://github.com/PowerShell/PowerShell/issues/5974) for a discussion. The _workaround_ is to use the _platform-native shell_ instead, as shown in [this answer](https://stackoverflow.com/a/48372333/45375). – mklement0 Jun 02 '21 at 02:28
-
@ZackA, your PowerShell result doesn't make sense to me, because it should be the same as the output from `echo '12346' | md5sum` in `zsh`, but hopefully the linked post still solves your problem. – mklement0 Jun 02 '21 at 02:33
-
It appears that MS has changed this behavior in PowerShell 7.2... – Zack A Jan 14 '22 at 02:33