Joshua Megnauth
108461f637
Fix title() and capitalize() ( #7717 )
...
* PyBytes.title should be ASCII-only.
* Use icu_casemap over unicode-casing for titles
`icu_casemap` is consistently maintained, official, and tracks the
latest Unicode versions. RustPython is also using other `icu4x` crates,
so using `icu_casemap` is more consistent.
As with islower and isupper, tracking the latest Unicode version is
important because character definitions shift over time which causes
discrepancies between RustPython and CPython.
This commit fixes title().
* Use icu_casemap for capitalize()
I dropped unicode-casing because it's cleaner to use icu4x for
everything. `icu4x` will also stay up to date whereas unicode-casing
will need to be periodically updated with new Unicode tables. Dropping
unicode-casing also removes some binary bloat due to the tables.
`capitalize()` mimics CPython behavior more closely now as well.
Notably, I implemented CPython's sigma edge case handler.
* Match CPython's title() exactly
2026-05-09 18:03:21 +00:00
..
2023-02-25 22:59:57 +09:00
2025-04-11 09:30:58 +09:00
2026-02-02 00:43:07 +09:00
2026-04-29 18:14:32 +09:00
2026-01-19 00:38:51 +09:00
2026-01-09 15:28:12 +09:00
2026-02-18 03:09:55 +09:00
2026-01-01 14:44:53 +09:00
2026-01-17 18:15:35 +09:00
2026-02-06 12:05:17 +09:00
2026-01-17 19:22:00 +09:00
2026-01-24 19:12:23 +09:00
2026-04-14 21:02:25 +09:00
2026-02-05 00:21:34 +09:00
2026-01-18 19:16:48 +09:00
2025-07-20 10:33:02 +09:00
2026-02-04 11:16:15 +09:00
2026-02-13 22:15:19 +09:00
2026-04-10 09:16:10 +09:00
2026-01-20 15:29:05 +09:00
2026-01-19 02:45:47 +09:00
2026-01-17 19:21:11 +09:00
2026-03-02 01:24:15 +09:00
2026-05-09 18:03:21 +00:00
2025-04-06 17:21:28 +09:00
2026-02-08 12:51:38 +00:00
2026-05-01 11:06:24 +00:00
2026-04-10 09:16:10 +09:00
2026-01-17 19:21:10 +09:00
2026-01-03 16:29:10 +09:00
2026-02-27 09:44:41 +01:00
2026-02-14 18:18:53 +02:00
2026-04-10 09:16:10 +09:00
2026-03-01 20:51:10 +09:00
2024-04-23 11:57:46 +09:00
2023-02-25 22:59:57 +09:00
2025-03-20 14:28:26 +09:00
2026-04-10 09:16:10 +09:00
2025-03-10 11:43:53 +09:00
2026-02-02 01:20:23 +09:00
2026-01-21 01:01:09 +09:00
2026-01-17 19:22:00 +09:00
2026-02-05 19:27:10 +09:00
2025-01-11 18:48:27 +09:00
2026-01-12 15:33:28 +09:00
2025-03-10 11:43:53 +09:00
2026-02-15 00:37:14 +09:00
2026-03-18 22:09:00 +09:00
2025-03-10 23:13:32 -07:00
2025-06-29 12:49:14 +09:00
2026-01-18 13:59:49 +09:00
2026-02-06 20:37:18 +09:00
2026-02-24 01:07:30 +00:00
2026-01-30 16:38:36 +02:00
2026-02-13 14:13:30 +09:00
2026-02-13 13:55:05 +09:00
2024-05-09 23:04:31 +09:00
2026-02-24 01:07:30 +00:00
2025-06-29 03:03:19 +09:00
2026-01-30 19:21:10 +09:00
2025-06-29 12:49:14 +09:00
2026-04-10 09:16:10 +09:00
2023-02-28 17:34:18 +00:00
2026-04-10 09:16:10 +09:00
2026-02-02 01:20:23 +09:00
2026-01-19 00:04:06 +09:00
2026-02-28 12:09:59 +09:00
2023-12-24 03:54:18 +08:00
2026-01-19 00:38:51 +09:00
2026-01-17 19:22:00 +09:00
2026-01-24 11:37:32 +09:00
2026-02-01 18:55:19 -05:00
2026-01-31 10:11:58 +09:00
2026-02-07 13:41:45 +09:00
2025-04-21 20:45:06 -07:00
2026-02-25 21:15:55 +09:00
2026-02-07 19:09:42 +09:00
2025-08-01 22:39:00 +09:00
2026-01-18 08:53:41 +09:00
2026-02-10 00:05:15 +09:00
2026-01-24 00:24:12 +09:00
2026-02-18 00:43:49 +09:00
2026-02-08 19:38:26 +09:00
2026-02-24 01:07:30 +00:00
2026-01-30 16:38:36 +02:00
2026-02-08 20:36:35 +09:00
2026-01-26 10:40:22 +09:00
2026-02-11 16:47:03 +09:00
2026-01-12 15:33:28 +09:00
2026-02-15 00:38:01 +09:00
2026-01-03 08:27:18 +09:00
2025-04-30 14:33:52 +09:00
2026-02-13 22:15:19 +09:00
2026-01-30 07:48:29 +09:00
2026-02-02 09:09:19 +09:00
2026-01-20 17:32:52 +09:00
2025-08-04 20:10:02 +09:00
2026-02-08 16:35:56 +09:00
2026-02-08 16:35:56 +09:00
2026-01-30 20:48:57 +09:00
2026-04-10 09:16:10 +09:00
2026-01-18 01:23:34 +09:00
2026-01-19 00:38:51 +09:00
2026-02-14 21:40:04 +09:00
2026-01-18 01:23:34 +09:00
2026-02-15 21:04:32 +09:00
2026-02-01 19:40:43 -05:00
2026-04-10 09:16:10 +09:00
2026-02-13 14:13:30 +09:00
2026-01-18 01:23:34 +09:00
2024-06-21 22:37:15 +09:00
2026-02-09 12:56:53 +09:00
2026-03-06 06:00:08 +09:00
2026-01-19 00:38:51 +09:00
2026-02-14 18:19:57 +02:00
2026-01-21 20:14:30 +09:00
2026-03-12 20:52:24 +09:00
2025-08-20 14:08:05 +09:00
2026-01-25 00:18:55 +09:00
2026-01-25 00:18:55 +09:00
2025-09-11 22:43:11 +09:00
2026-03-01 14:51:54 +09:00
2026-01-23 23:57:31 +09:00
2026-01-30 20:48:57 +09:00
2026-02-03 22:10:31 +09:00
2026-02-11 16:50:23 +09:00
2026-02-05 19:27:10 +09:00
2026-02-06 20:37:18 +09:00
2026-03-03 20:00:50 +09:00
2026-01-04 10:02:24 +09:00
2026-01-04 10:02:24 +09:00
2026-03-12 18:08:56 +09:00
2026-02-13 20:24:57 +09:00
2026-02-06 01:14:55 +09:00
2026-01-05 14:38:04 +09:00
2026-01-30 19:24:33 +09:00
2025-07-25 10:50:17 +09:00
2026-02-13 18:07:25 +09:00
2026-02-04 18:32:45 +09:00
2026-01-24 10:57:22 +09:00
2026-02-28 22:50:51 +09:00
2026-01-21 15:10:40 +09:00
2025-07-17 13:44:18 +09:00
2025-09-11 22:43:11 +09:00
2025-04-21 21:11:42 -07:00
2025-07-17 00:04:12 +09:00
2025-07-20 10:31:58 +09:00
2026-01-01 17:15:00 +09:00
2026-02-02 08:10:15 +09:00
2026-02-15 09:02:24 +09:00
2024-04-26 01:39:02 +09:00
2026-01-17 19:21:10 +09:00
2026-03-04 17:47:40 +09:00
2026-02-01 20:23:50 -05:00
2026-01-03 16:27:25 +09:00
2024-03-22 14:54:02 +09:00
2026-01-05 13:55:07 +09:00
2024-03-22 14:54:02 +09:00
2026-03-01 11:36:46 +09:00
2026-02-14 09:18:09 +09:00
2026-02-11 18:01:41 +09:00
2026-01-21 03:05:05 +09:00
2026-04-10 09:16:10 +09:00
2026-01-30 19:13:59 +02:00
2026-02-02 11:51:53 +09:00
2026-02-27 16:53:55 +09:00
2026-04-10 09:16:10 +09:00
2026-01-30 20:48:57 +09:00
2026-01-18 08:53:41 +09:00
2026-02-01 14:52:36 +09:00
2026-01-22 08:02:43 +09:00
2026-03-10 11:28:16 +09:00
2026-03-04 05:38:58 +09:00
2026-04-28 21:10:33 +09:00
2026-01-05 14:38:04 +09:00
2026-02-18 17:19:49 +09:00
2026-02-11 09:39:04 +09:00
2026-02-02 14:01:59 +09:00
2026-01-18 13:59:49 +09:00
2026-02-13 13:42:22 +09:00
2026-01-30 19:21:10 +09:00
2025-04-21 16:54:00 +09:00
2026-03-05 17:25:59 +09:00
2026-01-24 16:11:36 +09:00