Title: Compare-Object with [char] instances is unexpectedly case-sensitive by default · Issue #17758 · PowerShell/PowerShell · GitHub
Open Graph Title: Compare-Object with [char] instances is unexpectedly case-sensitive by default · Issue #17758 · PowerShell/PowerShell
X Title: Compare-Object with [char] instances is unexpectedly case-sensitive by default · Issue #17758 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/17758
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Compare-Object with [char] instances is unexpectedly case-sensitive by default","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nIf `[char]` instances were consistently compared case-insensitively to each other and to strings, all of the following commands would output `0`.\r\n\r\n```powershell\r\n# OK: [string] vs. [string]\r\n(Compare-Object ('a') ('A')).Count\r\n# OK: [string] vs. [char]\r\n(Compare-Object ('a') ([char] 'A')).Count\r\n# !! BROKEN: [char] vs. [char]\r\n(Compare-Object ([char] 'a') ([char] 'A')).Count\r\n# !! BROKEN: [char] vs. [string]\r\n(Compare-Object ([char] 'a') ('A')).Count\r\n```\r\n\r\nNote that `[char] 'a' -eq [char] 'A'` is `$true` (even though with `-gt`, `-lt`, `...` it is the _code points_ that get compared, resulting in case-sensitive behavior).\r\n\r\n#12498 is conceptually related, but would not fix this issue, because use of the `IEquatable\u003cT>` interface would also result in case-sensitive behavior.\r\n\r\n### Expected behavior\r\n\r\n```console\r\n0\r\n0\r\n0\r\n0\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```console\r\n0\r\n0\r\n2\r\n2\r\n```\r\n\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nPowerShell Core 7.3.0-preview.6\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2022-07-24T13:36:29Z","url":"https://github.com/PowerShell/PowerShell/issues/17758"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:49126481-6053-de8d-8e69-ee927972c369 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C330:3F1330:DA3AC:131C08:6AFD6B49 |
| html-safe-nonce | bcf5542b0a411166fdaade06b8c8e3be9c2583f30fe1f7a1210f30a49cc483a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzMwOjNGMTMzMDpEQTNBQzoxMzFDMDg6NkFGRDZCNDkiLCJ2aXNpdG9yX2lkIjoiMjI5NTE4ODUxMTQwNzMwMzQ5NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 967f7fa5de2ec3c07f647dfce7e64f044614ca533d5ca2ff0a3b05e980c903b9 |
| hovercard-subject-tag | issue:1315909798 |
| 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/17758/issue_layout |
| twitter:image | https://opengraph.githubassets.com/91d664037d3107e43021c345c41d16cc2b0dcf649f02ad216c31873fe5adccdd/PowerShell/PowerShell/issues/17758 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/91d664037d3107e43021c345c41d16cc2b0dcf649f02ad216c31873fe5adccdd/PowerShell/PowerShell/issues/17758 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| 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 | 9985ca2e21b59673104d4d830d4afeb946c67f248f273ab2e824c31c8db46e4a |
| 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 | 0db9e8d463c3f4540570e6ad3c501a06db9dc02a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width