Search code examples
bashunicodeluaawesome-wm

AwesomeWM non-ascii character doesn't display


In my wibox taskbar, I have a wibox.widget.textbox whose text is set using the textbox:set_text method.

The text comes from a bash command, whose output is recieved with io:popen():

local fd = io.popen("sensors | grep -oP 'Physical\\s+id\\s+\\d+:\\s+\\+\\K[0-9.]+'")
local out = fd:read("*all")
fd:close()    
temp_widget:set_text(out)

However, out contains a non-ascii symbol: the degree character °.

And in my taskbar, this character is displayed as �, which is itself a unicode character: U+FFFD. So I presume that awesome supports unicode, so why this char isn't displaying correctly?

EDIT: Also, as a side problem, I can't append a string to my output. IE, if I do temp_widget:set_text(out .. "foobar"), the result is the same as temp_widget:set_text(out). How to append a string then?


Solution

  • I solved my problem with removing the degree sign from my grep string, and appending it again in lua. So the font wasn't the problem, nor the widget assuming the encoding was not unicode.

    l0b0 was right about the out ending with a new line though, it solved my second problem.