nushell/crates/nu-command/src/strings
Antoine Stevan 01d8961eb7
use to_lowercase in str downcase (#10850)
# Description
as we can see in the [documentation of
`str.to_lowercase`](https://doc.rust-lang.org/std/primitive.str.html#method.to_lowercase),
not only ASCII symbols have lower and upper variants.

- `str upcase` uses the correct method to convert the string

7ac5a01e2f/crates/nu-command/src/strings/str_/case/upcase.rs (L93)
- `str downcase` incorrectly converts only ASCII characters

7ac5a01e2f/crates/nu-command/src/strings/str_/case/downcase.rs (L124)

this PR uses `str.to_lower_case` instead of `str.to_ascii_lowercase` in
`str downcase`.

# User-Facing Changes
- upcase still works fine
```nushell
~ l> "ὀδυσσεύς" | str upcase
ὈΔΥΣΣΕΎΣ
```
- downcase now works

👉 before
```nushell
~ l> "ὈΔΥΣΣΕΎΣ" | str downcase
ὈΔΥΣΣΕΎΣ
```
👉 after
```nushell
~ l> "ὈΔΥΣΣΕΎΣ" | str downcase
ὀδυσσεύς
```

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
-  `toolkit test`
-  `toolkit test stdlib`

adds two tests
- `non_ascii_upcase`
- `non_ascii_downcase`

# After Submitting
2023-10-27 19:16:17 +02:00
..
encode_decode Use long options for string (#10777) 2023-10-19 22:08:09 +02:00
format update format date when using %x %X %r (#10272) 2023-09-08 08:59:05 -05:00
split Use long options for string (#10777) 2023-10-19 22:08:09 +02:00
str_ use to_lowercase in str downcase (#10850) 2023-10-27 19:16:17 +02:00
char_.rs Use long options for string (#10777) 2023-10-19 22:08:09 +02:00
detect_columns.rs Use long options for string (#10777) 2023-10-19 22:08:09 +02:00
mod.rs Move format duration/filesize back into core (#9978) 2023-08-11 06:01:47 +12:00
parse.rs Use long options for string (#10777) 2023-10-19 22:08:09 +02:00
size.rs Deprecate size to str stats (#10798) 2023-10-21 11:21:34 -05:00