diff --git a/tests/data/separator_unicode/cmd_and_expected_output b/tests/data/separator_unicode/cmd_and_expected_output new file mode 100644 index 0000000..0f23100 --- /dev/null +++ b/tests/data/separator_unicode/cmd_and_expected_output @@ -0,0 +1,3 @@ +$ cat $TEST_DIR/separator_unicode.tsv | $TSV2TABLE --separator=Ф +1 | 2 +a | b | c diff --git a/tests/data/separator_unicode/separator_unicode.tsv b/tests/data/separator_unicode/separator_unicode.tsv new file mode 100644 index 0000000..670772f --- /dev/null +++ b/tests/data/separator_unicode/separator_unicode.tsv @@ -0,0 +1,2 @@ +1Ф2 +aФbФc diff --git a/tsv2table b/tsv2table index f3a3d2c..ac8858c 100755 --- a/tsv2table +++ b/tsv2table @@ -6,7 +6,9 @@ use feature qw(say); use utf8; use open qw(:std :utf8); +use Encode qw(decode); use Getopt::Long; +use I18N::Langinfo qw(CODESET langinfo); sub parse_options { @@ -14,6 +16,9 @@ sub parse_options { my $separator; my $help; + my $codeset = langinfo(CODESET); + @ARGV = map { decode $codeset, $_ } @ARGV; + GetOptions ( 'header=s' => \$header, 'separator=s' => \$separator, @@ -81,6 +86,7 @@ https://github.com/bessarabov/tsv2table separator => $separator, }; + return $options; } # my ($type, $non_fractional_length, $fractional_length) = get_type('13.123'); # ('float', 2, 4)