nushell/crates/nu-command/src/formats/from
Christian Friedow 66ad83c15c
from ssv --aligned-columns should separate lines by character index instead of byte index (#8558)
# Description

## Symptom
Lines which are input into `from ssv --aligned-columns` are split
incorrectly of they contain utf-8 characters which have the length of
multiple bytes. Notice how the values of the `Bars` column bleeds into
the `Security` column in the following output (the big grey areas are
censored data ;) ):

![before-patch](https://user-images.githubusercontent.com/17351844/226757737-be7ca493-5c64-4a91-9153-984df515bb8c.png)

## Problem
The function behind `from ssv --aligned-columns` splits lines into
fields by byte index (which is default behavior of str.get(...) in Rust)
instead of character index. If the header row has a different length in
bytes than the remaining table rows, the split is executed incorrectly.

## Solution
The function behind `from ssv --aligned-columns1 now separates lines by
character index instead of byte index. This productes the following
(correct) output (the big grey areas are censored data ;) ):

![after-patch](https://user-images.githubusercontent.com/17351844/226757850-7acaebf3-2d40-4f85-b76e-64e465254bda.png)
2023-03-22 17:54:18 -05:00
..
command.rs Uniformize usage() and extra_usage() message ending for commands helper. (#8268) 2023-02-28 21:33:02 -08:00
csv.rs Additional flags for commands from csv and from tsv (#8398) 2023-03-16 17:49:46 -05:00
delimited.rs Additional flags for commands from csv and from tsv (#8398) 2023-03-16 17:49:46 -05:00
json.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00
mod.rs Move some from xxx commands to plugin (#7942) 2023-02-13 12:42:08 +00:00
nuon.rs Uniformize usage() and extra_usage() message ending for commands helper. (#8268) 2023-02-28 21:33:02 -08:00
ods.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00
ssv.rs from ssv --aligned-columns should separate lines by character index instead of byte index (#8558) 2023-03-22 17:54:18 -05:00
toml.rs Document and critically review ShellError variants - Ep. 3 (#8340) 2023-03-06 18:33:09 +01:00
tsv.rs Additional flags for commands from csv and from tsv (#8398) 2023-03-16 17:49:46 -05:00
url.rs Use imported names in Command::run signatures (#7967) 2023-02-05 22:17:46 +01:00
xlsx.rs Document and critically review ShellError variants - Ep. 2 (#8326) 2023-03-06 11:31:07 +01:00
xml.rs Fix xml docs (#8462) 2023-03-15 07:21:48 -05:00
yaml.rs Added fix for bug #8278 to read tag values from YAML files (#8354) 2023-03-16 09:50:30 -05:00