in reply to Term::ReadLine handle wide character poorly

Hi

I tested your code above without the decode and it worked perfectly* as I expected.

By default it was using Term::ReadLine::Gnu but I also tried using Term::ReadLine::Perl5 and it also worked exactly the same

* I don't have a chinese keyboard, but I was copying 弛 and 地 from wikipedia

What exactly is it doing wrong for you?

Replies are listed 'Best First'.
Re^2: Term::ReadLine handle wide character poorly
by vincentaxhe (Scribe) on May 14, 2024 at 04:32 UTC

    It swallow wide character to squeeze in a non-wide character length, it start to do that after input eight or nine wide characters, it keeps doing that, then wrap line upward, very clumsy line input environment

Re^2: Term::ReadLine handle wide character poorly
by The_Dj (Scribe) on May 14, 2024 at 17:12 UTC
    Can you paste a string here I could test with?

      Its behavior varies depending you paste repeatly and type in, paste will show '[27m', type in will squeeze character, neither is desirable. try paste '一生'.

      I use fcitx in arch, you will need 'fcitx5 fcitx5-chinese-addons fcitx5-configtool fcitx5-gtk-git fcitx5-pinyin-zhwiki fcitx5-qt', relogin and some environment settings. here is my hyprland env settings related to fcitx. make it work takes some efforts.

      env = XMODIFIERS, @im=fcitx # env = GTK_IM_MODULE, fcitx env = QT_IM_MODULE, fcitx env = SDL_IM_MODULE, fcitx env = ECORE_IMF_MODULE,xim
      sorry, its alacritty I use, kitty and foot works fine.