You are not logged in.

#1 2015-10-09 17:23:41

Arial7
Member
Registered: 2015-10-09
Posts: 10

[i3status] No UTF-8 characters in i3status, but through wrapper script

Hello guys, my first post on here, so bear with me smile

I wanted to get some UTF-8 icons in my i3bar. I did that on my chromebook (running chrubuntu) too and it looks pretty slick.
So i copied the basic python wrapper script example, because I wanted my CPU temp too.

Then I edited my i3status.conf to include some UTF-8 symbols with the FontAwesome font, just like I did on my laptop.
But instead of getting the icons, I only get those "square characters" containing the unicode code. The suprising thing is, that if I add unicode characters in my python wrapper script, it displays them correctly.

A few things I already did:

file .i3/i3status.conf
.i3/i3status.conf: UTF-8 Unicode text

-Just like on my laptop

file .i3/i3status_wrapper.py 
.i3/i3status_wrapper.py: Python script, UTF-8 Unicode text executable

-Just like on my laptop

locale

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

-again, same on my laptop

So does anyone have some kind of advice?
(PS: sorry if this in the wrong category)

Offline

#2 2015-10-09 17:44:01

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: [i3status] No UTF-8 characters in i3status, but through wrapper script

What exactly is the content of your i3status.conf?

Last edited by progandy (2015-10-09 17:44:39)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#3 2015-10-09 18:16:10

Arial7
Member
Registered: 2015-10-09
Posts: 10

Re: [i3status] No UTF-8 characters in i3status, but through wrapper script

general {
    colors = false
    interval = 1
	output_format = i3bar

}

order += "disk /"
order += "ethernet _first_"
order += "tztime local"


wireless _first_ {
        format_up = "W: (%quality at %essid) %ip"
        format_down = "W: down"
}

ethernet _first_ {
        # if you use %speed, i3status requires root privileges
        format_up = "  %ip"
        format_down = "  Not Connected"
}

battery 0 {
        format = "%status %percentage %remaining"
}

run_watch DHCP {
        pidfile = "/var/run/dhclient*.pid"
}

run_watch VPN {
        pidfile = "/var/run/vpnc/pid"
}

tztime local {
        format = " %d-%m-%Y  %H:%M:%S"
}

load {
        format = "%1min"
}

disk "/" {
        format = " %avail free"
}

So basically I just removed the unneccesary stuff and added the unicode symbols

And this is the output:

screenshot

As you can see, the temperature (added by the python wrapper shows the correct icon)

Last edited by Arial7 (2015-10-09 18:27:23)

Offline

#4 2015-10-09 18:24:06

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: [i3status] No UTF-8 characters in i3status, but through wrapper script

Did you try the same fontawesome symbol in your python script as in your config file? Did you add FontAwesome to your font descripton in i3.conf, e.g. "font pango:Cousine, FontAwesome 8"


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#5 2015-10-09 18:31:01

Arial7
Member
Registered: 2015-10-09
Posts: 10

Re: [i3status] No UTF-8 characters in i3status, but through wrapper script

Yes, I tried the same icons, again, python worked, i3status not...

Actually i even tried FontAwesome as my ONLY font as well, nothing worked, that's why I am posting here hmm

The thing that bug me most is that it works on a (seemingly) similar config on chrubuntu

Offline

#6 2015-10-09 19:01:41

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: [i3status] No UTF-8 characters in i3status, but through wrapper script

I have a similar setup running on arch (without the python wrapper, but with infinality-bundle if that matters). Currently I have not many other ideas about what could be wrong.
Maybe ubuntu runs the wrapper with python2 while arch uses python3. There could be some utf8 decoding/encoding going on that destroys a few symbols. Can you try to run i3status without the wrapper in a terminal, write the output in a file and display it with some tool like pango-view, maybe repeat that with the wrapper, too.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#7 2015-10-09 19:05:15

Arial7
Member
Registered: 2015-10-09
Posts: 10

Re: [i3status] No UTF-8 characters in i3status, but through wrapper script

Good idea, i will try that and report back.

Actually, on ubuntu i changed the default python symlink to python3 as I use python3 features all the time smile

Offline

#8 2015-10-09 20:06:03

Arial7
Member
Registered: 2015-10-09
Posts: 10

Re: [i3status] No UTF-8 characters in i3status, but through wrapper script

I've just ran

i3status -c .i3/i3status.conf

in my terminal and the output was like it should be:

...[{"name":"disk_info","instance":"/","full_text":" 87.3 GiB free"},{"name":"ethernet","instance":"enp2s0","full_text":"  192.168.2.120"},{"name":"tztime","full_text":" 09-10-2015  22:03:10"}]...

As you can see, it renders the correct symbols in the terminal. I guess it has to be something with python reading the unicode wrong from the stdio?

EDIT:
when I pipe the above command into my wrapper script, it outputs the following:

[{"full_text": "\uf0e4 35.0\u00b0C", "name": "temp1"}, {"instance": "/", "full_text": "\uf0a0 87.3 GiB free", "name": "disk_info"}, {"instance": "enp2s0", "full_text": "\uf1eb  192.168.2.120", "name": "ethernet"}, {"full_text": "\uf073 09-10-2015 \uf017 22:07:00", "name": "tztime"}]

As you can see, all the unicode icons are encoded the right way....

Last edited by Arial7 (2015-10-09 20:09:26)

Offline

#9 2015-10-10 09:08:03

Arial7
Member
Registered: 2015-10-09
Posts: 10

Re: [i3status] No UTF-8 characters in i3status, but through wrapper script

Hey guys, I'm pleased to say that this issue has resolved itself big_smile

After rebooting for the 5th or so time, it just magically works?!

Offline

Board footer

Powered by FluxBB