Title: String#toLowerCase fails to lower final sigma after a space or non-cased character · Issue #3063 · AssemblyScript/assemblyscript · GitHub
Open Graph Title: String#toLowerCase fails to lower final sigma after a space or non-cased character · Issue #3063 · AssemblyScript/assemblyscript
X Title: String#toLowerCase fails to lower final sigma after a space or non-cased character · Issue #3063 · AssemblyScript/assemblyscript
Description: Bug description String#toLowerCase() lowers Greek Σ (U+03A3) at the end of a word to medial σ (U+03C3) instead of final ς (U+03C2) whenever a non-cased, non-case-ignorable character (such as a space or digit) appears earlier in the strin...
Open Graph Description: Bug description String#toLowerCase() lowers Greek Σ (U+03A3) at the end of a word to medial σ (U+03C3) instead of final ς (U+03C2) whenever a non-cased, non-case-ignorable character (such as a spac...
X Description: Bug description String#toLowerCase() lowers Greek Σ (U+03A3) at the end of a word to medial σ (U+03C3) instead of final ς (U+03C2) whenever a non-cased, non-case-ignorable character (such as a spac...
Opengraph URL: https://github.com/AssemblyScript/assemblyscript/issues/3063
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"String#toLowerCase fails to lower final sigma after a space or non-cased character","articleBody":"### Bug description\n\n`String#toLowerCase()` lowers Greek `Σ` (U+03A3) at the end of a word to medial `σ` (U+03C3) instead of final `ς` (U+03C2) whenever a non-cased, non-case-ignorable character (such as a space or digit) appears earlier in the string within the lookbehind window.\n\nSingle-word `\"ΟΔΟΣ\".toLowerCase()` returns `\"οδος\"` as expected, but `\"Η ΟΔΟΣ\".toLowerCase()` returns `\"η οδοσ\"` instead of `\"η οδος\"`, and `\"1 AΣ\".toLowerCase()` returns `\"1 aσ\"` instead of `\"1 aς\"`. In JavaScript, `Σ` is lowered to `ς` whenever it is immediately preceded by a cased character (ignoring case-ignorable characters) and not followed by one.\n\nIn `isFinalSigma`, the backward loop sets `found = true` when it matches a preceding cased character, but is missing a `break;`, so it continues scanning backwards and returns `false` upon hitting an earlier space or other non-cased character.\n\n### Steps to reproduce\n\n```ts\nassert(\"ΟΔΟΣ\".toLowerCase() == \"οδος\"); // passes\nassert(\"Η ΟΔΟΣ\".toLowerCase() == \"η οδος\"); // fails: returns \"η οδοσ\"\nassert(\"1 AΣ\".toLowerCase() == \"1 aς\"); // fails: returns \"1 aσ\"\n```\n\nCredit: https://ucsbplse.github.io/\n\n### AssemblyScript version\n\nv0.28.20\n\n### Playground\n\nhttps://www.assemblyscript.org/editor.html#IyFvcHRpbWl6ZT1zcGVlZCZydW50aW1lPWluY3JlbWVudGFsCi8vIGZpbmFsIHNpZ21hIFUrMDNDMiBleHBlY3RlZCBhZnRlciBhIGNhc2VkIGxldHRlcgpleHBvcnQgZnVuY3Rpb24gdDEoKTogYm9vbCB7IHJldHVybiAiXHUwMzlGXHUwMzk0XHUwMzlGXHUwM0EzIi50b0xvd2VyQ2FzZSgpID09ICJcdTAzQkZcdTAzQjRcdTAzQkZcdTAzQzIiOyB9CmV4cG9ydCBmdW5jdGlvbiB0MigpOiBib29sIHsgcmV0dXJuICJcdTAzOTcgXHUwMzlGXHUwMzk0XHUwMzlGXHUwM0EzIi50b0xvd2VyQ2FzZSgpID09ICJcdTAzQjcgXHUwM0JGXHUwM0I0XHUwM0JGXHUwM0MyIjsgfQpleHBvcnQgZnVuY3Rpb24gdDMoKTogYm9vbCB7IHJldHVybiAiMSBBXHUwM0EzIi50b0xvd2VyQ2FzZSgpID09ICIxIGFcdTAzQzIiOyB9CiMhaHRtbAo8cHJlIGlkPSJvdXQiPjwvcHJlPgo8c2NyaXB0IHR5cGU9Im1vZHVsZSI+CmNvbnN0IGUgPSBhd2FpdCBpbnN0YW50aWF0ZShhd2FpdCBjb21waWxlKCksIHt9KTsKZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoIm91dCIpLnRleHRDb250ZW50ID0gWwogICJ0MSgpID0gIiArIGUudDEoKSArICIgIChleHBlY3RlZCB0cnVlKSIsCiAgInQyKCkgPSAiICsgZS50MigpICsgIiAgKGV4cGVjdGVkIHRydWUpIiwKICAidDMoKSA9ICIgKyBlLnQzKCkgKyAiICAoZXhwZWN0ZWQgdHJ1ZSkiCl0uam9pbigiXG4iKTsKPC9zY3JpcHQ+\n\nClick Run: `t1` (single word) prints `true`, but `t2` and `t3` (a space before the word) print `false`.\n","author":{"url":"https://github.com/trackoor","@type":"Person","name":"trackoor"},"datePublished":"2026-11-07T03:46:50Z","url":"https://github.com/AssemblyScript/assemblyscript/issues/3063"}
| 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:877f5329-b573-b0b0-4e0e-1b244fda5610 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3BA:14B836:CFF6CD:116515C:6B0051D5 |
| html-safe-nonce | 0c03830a632bce123d5068463a5b6667aaa2b936b77b9d076120b89921125e0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0JBOjE0QjgzNjpDRkY2Q0Q6MTE2NTE1Qzo2QjAwNTFENSIsInZpc2l0b3JfaWQiOiI4NzgxOTk4NjM3ODQ5NzkyOTgxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1c8a26230644145c891272fc2cf1d5dba3d08e50478366c9a69343ee790e8dba |
| hovercard-subject-tag | issue:6254809735 |
| 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/AssemblyScript/assemblyscript/3063/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0ecf2286e04ad35e7231efd6a63e2520713a1f801f441decd8329e0f0e4b9ff1/AssemblyScript/assemblyscript/issues/3063 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0ecf2286e04ad35e7231efd6a63e2520713a1f801f441decd8329e0f0e4b9ff1/AssemblyScript/assemblyscript/issues/3063 |
| og:image:alt | Bug description String#toLowerCase() lowers Greek Σ (U+03A3) at the end of a word to medial σ (U+03C3) instead of final ς (U+03C2) whenever a non-cased, non-case-ignorable character (such as a spac... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trackoor |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| turbo-cache-control | no-preview |
| go-import | github.com/AssemblyScript/assemblyscript git https://github.com/AssemblyScript/assemblyscript.git |
| octolytics-dimension-user_id | 28916798 |
| octolytics-dimension-user_login | AssemblyScript |
| octolytics-dimension-repository_id | 105138356 |
| octolytics-dimension-repository_nwo | AssemblyScript/assemblyscript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 105138356 |
| octolytics-dimension-repository_network_root_nwo | AssemblyScript/assemblyscript |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width