Title: Start-Transcript uses lossy ASCII character encoding instead of BOM-less UTF-8 if the target file happens to exist · Issue #13677 · PowerShell/PowerShell · GitHub
Open Graph Title: Start-Transcript uses lossy ASCII character encoding instead of BOM-less UTF-8 if the target file happens to exist · Issue #13677 · PowerShell/PowerShell
X Title: Start-Transcript uses lossy ASCII character encoding instead of BOM-less UTF-8 if the target file happens to exist · Issue #13677 · PowerShell/PowerShell
Description: Note: Windows PowerShell is not affected - UTF-8 with BOM is used consistently there. A fix for the closely related #13678 could probably encompass a fix for this issue as well. When the target file happens to exist and doesn't have a BO...
Open Graph Description: Note: Windows PowerShell is not affected - UTF-8 with BOM is used consistently there. A fix for the closely related #13678 could probably encompass a fix for this issue as well. When the target fil...
X Description: Note: Windows PowerShell is not affected - UTF-8 with BOM is used consistently there. A fix for the closely related #13678 could probably encompass a fix for this issue as well. When the target fil...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/13677
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Start-Transcript uses lossy ASCII character encoding instead of BOM-less UTF-8 if the target file happens to exist","articleBody":"Note: \r\n * Windows PowerShell is _not_ affected - UTF-8 with BOM is used consistently there.\r\n * A fix for the closely related #13678 could probably encompass a fix for this issue as well.\r\n\r\nWhen the target file _happens to exist and doesn't have a BOM_ - even without `-Append` - `Start-Transcript` mistakenly uses ASCII encoding to write the file.\r\n\r\nWithout `-Append`, `Start-Transcript` shouldn't even look at the existing file - it should simply replace it, and use the default encoding (BOM-less UTF-8). See #13678 for a closely related bug _with_ `-Append`.\r\n\r\nInstead, `Start-Transcript` apparently looks for a BOM at the start of an existing file and uses ASCII encoding if it doesn't find one.\r\n\r\n## Steps to reproduce\r\n\r\n```powershell\r\n# To surface the bug, make sure that the target file exists and doesn't have a BOM.\r\n$null \u003e temp:/$PID.txt\r\n\r\n$null = Start-Transcript temp:/$PID.txt\r\n'ü' # output a string with a non-ASCII-range character\r\n$null = Stop-Transcript\r\n\r\nSelect-String -Quiet 'ü' temp:/$PID.txt | Should -BeTrue\r\n\r\nRemove-Item temp:/$PID.txt\r\n```\r\n\r\n## Expected behavior\r\n\r\nThe test should succeed.\r\n\r\n## Actual behavior\r\n\r\nThe test fails, because `ü` was transliterated to verbatim `?`, suggesting that ASCII encoding was used to write the file.\r\n\r\n## Environment data\r\n\r\n```none\r\nPowerShell Core 7.1.0-preview.7\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2020-09-23T14:41:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":28},"url":"https://github.com/13677/PowerShell/issues/13677"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:13dc947a-2ae9-727c-1b1b-55a963abf102 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7AE:F87E9:118793:17A5CE:6A51D112 |
| html-safe-nonce | 1fa3d0d1da33c783f86ab8432cd222bdeb19510e36a34d4147791d91c3def381 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0FFOkY4N0U5OjExODc5MzoxN0E1Q0U6NkE1MUQxMTIiLCJ2aXNpdG9yX2lkIjoiMjE1MTQ0NTY4ODM5NDgzMDA5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b4b75b26bc7cd35a78ef12126d6c7b66edf2f522591a437f4e3e659a687548c3 |
| hovercard-subject-tag | issue:707427570 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/13677/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a5e51962ae7bf786c38b7a5c7c3c4782979c05f718e2df4713935b1a5759884b/PowerShell/PowerShell/issues/13677 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a5e51962ae7bf786c38b7a5c7c3c4782979c05f718e2df4713935b1a5759884b/PowerShell/PowerShell/issues/13677 |
| og:image:alt | Note: Windows PowerShell is not affected - UTF-8 with BOM is used consistently there. A fix for the closely related #13678 could probably encompass a fix for this issue as well. When the target fil... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width