I'm using GNU dialog in one of my lengthy shell scripts. One of the areas I've got problems with is when I'm asking for an inputBox where the user can type a book's title, mostly in French.

In this inputBox, entering accented characters (éàè are very common in French), or special UTF-8 characters such as the em-dash "—" shifts the cursor 4 characters right, instead of one. After 3 or 4 "special" characters, the inputbox is completely unusable because of this artifact.

Similarly, when I display a menu with dialog, accented characters shift the right border of the dialog box. That's less handicapping than in the inputBox, but yet it's a visual discomfort.

I've tried all kinds of stuff to get this working, to no avail.

For the record, here are my LC_* environment vars:


What could I do?

(Edit: as stated below, I'm on a Mac, and the same problem arises whether I use iTerm2 or the built-in Terminal emulator.)


I know it's an old question, but neverthereless the answer might be useful...

I solved the problem setting the following environment variable:


I have putty with the putty-256color Terminal string and a RHEL6 machine. It also works when using tmux or screen. For more information about this variable, just call 'man 3 ncurses'.

  • This actually solved another problem for me: the borders of the windows were displayed using letters instead of linedraw characters. Using NCURSES_NO_UTF8_ACS solves the issue. Thanks! – Ale Nov 11 '15 at 21:14

Make sure your terminal is in UTF-8 mode. If you are setting the locale variables from your ~/.bashrc as some do, then they will apply to the shell, but not to its parent terminal. Use tr \\0 \\n </proc/$PPID/environ to check whether the terminal has the same locale variables. (Some (such as GNOME Terminal) have an explicit character encoding menu, which you can use instead.)

Also, make sure the locale is listed by locale -a – if it is not, edit /etc/locale.gen and run locale-gen as root.

Note that it is not recommended to set LC_ALL unless necessary, as this makes overriding the more-specific variables impossible. Just LANG is enough

  • I don't have a /proc, as I'm on a Mac for iOS development. Whether I'm using iTerm2 (my default terminal) or Mac OS's standard Terminal, dialog exhibits this behavior. And my fr_FR.UTF-8 is correctly listed under locale -a. – Cyrille Sep 8 '11 at 20:06
  • ... (continued) but in iTerm2's settings, "Terminal Emulation > Character Encoding" is correctly set to "Unicode (UTF-8)". – Cyrille Sep 8 '11 at 20:06
  • Actually, my terminal works great when in bash or vi — I can enter accented characters and it does not mess with them. Only dialog produces this problem. Could it be a problem in ncurses' configuration? – Cyrille Sep 9 '11 at 13:21
  • Outdated ncurses and/or dialog, possibly? – grawity Sep 9 '11 at 13:58
  • I would be surprised, I've compiled them with MacPorts just a few days ago. nCurses is at 5.9.20110404 and dialog is 1.1-20110707. I've had this problem for months, anyway. – Cyrille Sep 9 '11 at 14:20

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.