Commit 1caa90c
committed
(GH-1759) Preserve encoding of commands in powershell transport
When conveying data from the WinRM transport back to the powershell
shell class, we use a set of pipes. Those pipes acquire the default
external encoding of Ruby, even though the winrm gem ensures that the
content will always be UTF-8. We now properly tag those pipes as UTF-8
to avoid the data being misinterpreted.
In order to preserve \r\n line endings for Windows targets, the
powershell shell class then puts those pipes into binmode. That causes
the character encoding information to be stripped away entirely. We now
save that encoding information before converting the pipe and we
reassert the encoding on the string after reading it.
This addresses an issue where systems with non-UTF-8 encodings would
have valid UTF-8 data misinterpreted as invalid data in their native
character encoding.
!bug
* **Improved support for non-UTF-8 character encodings**
([#1759](#1759))
Commands run from a target where the default character encoding is
non-UTF-8 will now return proper results when using the WinRM
transport.1 parent 940d3ea commit 1caa90c
2 files changed
+14
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
274 | 282 | | |
275 | 283 | | |
276 | 284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
| 111 | + | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
0 commit comments