d99kris / nchat

Terminal-based Telegram / WhatsApp client for Linux and macOS
MIT License
647 stars 45 forks source link

[Enhancement] Add support for non-UTF-8 locales #20

Closed saahriktu closed 3 years ago

saahriktu commented 4 years ago

nchat doesn't perform character set conversion between current locale and server side UTF-8 (for example, over iconv()). It makes impossible to use nchat with locales other than UTF-8.

d99kris commented 4 years ago

May I know the output of locale on your system? And also which terminal app/emulator in use, as well as OS? Just so I can try out a similar environment.

I'm not sure whether the line-drawing capabilities of ncursesw used by nchat can work with any locale, so there's a possibility it will be difficult to support, but I can look into it.

Btw, do things work fine if you force nchat to a UTF-8 locale, as in LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 nchat (all on one line) or does your terminal emulator not support it?

saahriktu commented 4 years ago

I use linux console (vt) with ru_RU.KOI8-R locale. ncurses with setlocale(LC_ALL, ""); works fine, but text need to be converted to proper codepage.

d99kris commented 4 years ago

Thanks! I haven't had time to look into this yet. I've mainly used UTF8 for my recent projects and I'm not really familiar with the best practise for supporting non-UTF8. If you know some other open-source software or two that handles this correctly, feel free to share the names, then I can look at those source codes to see what they do. Or feel free to submit a PR. :)

saahriktu commented 4 years ago

If you know some other open-source software or two that handles this correctly, feel free to share the names, then I can look at those source codes to see what they do.

lynx, irssi, lftp, links, bitlbee,... etc

d99kris commented 4 years ago

Great, thanks!

d99kris commented 3 years ago

After some consideration I've decided to leave non-UTF8 as out of scope for nchat. However, should someone prepare a pull request with the necessary changes I will be open reviewing and accepting/pulling it, as long as it's not too complex. Closing this issue for now.