[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command "read -N " doesn't respect UTF-8 encoding
From: |
Lawrence Velázquez |
Subject: |
Re: Command "read -N " doesn't respect UTF-8 encoding |
Date: |
Sat, 24 Oct 2020 20:23:02 -0400 |
> On Oct 24, 2020, at 3:51 PM, info@kablex.ru wrote:
>
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_$
> uname output: Linux bitrix-lamp 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u5
> (2017-09-19) x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 4.3
> Patch Level: 30
> Release Status: release
>
> Description:
> UTF-8 string piped to read command goes corrupt with -N option, e.g.
> printf "привет"|(read -N 100500 var_text; printf "$var_text" )
> returns some corrupt output "�#��#��#��#��#��#�"
> while
> printf "привет"|(read -n 100500 var_text; printf "$var_text" )
> returns correct output "привет"
>
>
> Repeat-By:
> as described above
FWIW your test case seems to work fine with a modern bash.
% bash --version | head -n 1
GNU bash, version 5.0.17(1)-release (x86_64-apple-darwin18.7.0)
% bash --norc <<\EOF
heredoc> printf "привет"|(read -N 100500 var_text; printf "$var_text" )
heredoc> EOF
привет%
--
vq