Welcome to awesome bug tracking system.

FS#801 - Prompt does not handle multibyte characters

Attached to Project: awesome
Opened by David Demelier (markand) - Wednesday, 25 August 2010, 18:18 GMT
Last edited by Uli Schlachter (psychon) - Thursday, 26 August 2010, 19:30 GMT
Task Type Bug Report
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity High
Priority Normal
Reported Version 3.4.7
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


On the default configuration, when you insert some multibyte characters with an UTF-8 locale you can't delete them it justs breaks the prompt.

For example, insert "bpaç" and press backspace, it leaves the prompt.

I used these locales :

This task depends upon

Closed by  Uli Schlachter (psychon)
Thursday, 26 August 2010, 19:30 GMT
Reason for closing:  Fixed
Additional comments about closing:  commit 1cab627d5d48d17f466ce7c58a8932b6b48ca994
Author: Uli Schlachter <>
Date: Thu Aug 26 20:42:22 2010 +0200

awful.prompt: "Fix" for multi-byte characters

If you entered a multi-byte character into a prompt and then changed your mind
and used backspace to fix the character, only the last byte of the character was
removed. Because pango is intelligent, it noticed the broken utf8 and

So far nothing new. But since 711d78b50c23ef8 the textbox will throw a lua error
when it gets an invalid text (= pango complains). Throwing an unprotected lua
error in this context causes the keygrabber to be killed which stops the prompt.

Fix this by removing bytes as long as there are bytes left that can be removed.

This is  FS#801 .

Signed-off-by: Uli Schlachter <>
Comment by Uli Schlachter (psychon) - Wednesday, 25 August 2010, 18:24 GMT
Thanks to my keyboard layout, I can't type any multibyte characters and so cant test this.

The prompt uses this code when you press backspace:
command = command:sub(1, cur_pos - 2)
I guess for multibyte characters this only removes one of the bytes of the char...

@David: Do you have any error messages on awesome's stderr?
I guess that the recent changes to the textbox to throw errors on invalid stuff strikes here. The keygrabber is stopped if the callback function throws a lua error.
Comment by Ignas Anikevicius (gns_ank) - Wednesday, 25 August 2010, 19:35 GMT
Bug 796 is also about the same issue.

As I remember I did not see anything strange on stderr, but it might be holes in my memory.
Comment by Uli Schlachter (psychon) - Wednesday, 25 August 2010, 21:02 GMT
Uhm, what? Why do you think this is  FS#796 ?
Comment by Ignas Anikevicius (gns_ank) - Thursday, 26 August 2010, 10:03 GMT
Ah, now when I read it now, it might be due to other issues.

I might have been confused as there isn't a lot of information on  FS#796  and when I tested it, I could type all the accented characters, but I could not delete them. So I thought, this is the problem  FS#796  is all about.

Either way, I have a function executed (to hide a wibox) after I press enter and I see, that the wibox is still pressent. So basically if a prompt tries to delete a multibyte character, it just terminates and that is it.
Comment by Uli Schlachter (psychon) - Thursday, 26 August 2010, 16:54 GMT
Which keyboard mapping are you using? I'd like to reproduce this and I would need a setxkbmap call for that and the info which keys I have to press to generate a multibyte character.
Comment by Ignas Anikevicius (gns_ank) - Thursday, 26 August 2010, 17:25 GMT
This is what stderr looks like:

You can use fr, and I guess any layout which has diacritic symbols like umlauts.
Comment by Ignas Anikevicius (gns_ank) - Thursday, 26 August 2010, 20:13 GMT
Thanks for this. Everytime I see the commit list I get amazed by your work.