You are not logged in.

#1 2015-07-21 10:54:28

nlern
Member
From: West Bengal, India
Registered: 2015-06-29
Posts: 51

[SOLVED] VNStat Weird Characters in Output

Hello everyone. I recently changed my Linux distro to Arch Linux. I installed LXDE as my Desktop Environment. I have also installed vnstat from Community repository to monitor my network usage.

$ pacman -Ss vnstat
community/vnstat 1.14-1 [installed]
    A console-based network traffic monitor
$ pacman -Qi vnstat
Name           : vnstat
Version        : 1.14-1
Description    : A console-based network traffic monitor
Architecture   : x86_64
URL            : http://humdi.net/vnstat/
Licenses       : GPL
Groups         : None
Provides       : None
Depends On     : bash
Optional Deps  : gd: image output [installed]
Required By    : None
Optional For   : None
Conflicts With : None
Replaces       : None
Installed Size : 338.00 KiB
Packager       : Sergej Pupykin <pupykin.s+arch@gmail.com>
Build Date     : Tuesday 28 April 2015 12:20:11 AM IST
Install Date   : Wednesday 01 July 2015 05:37:51 PM IST
Install Reason : Explicitly installed
Install Script : No
Validated By   : Signature

Whenever I type vnstat in LXTerminal to see the network usage, I see some weird characters in the output (View Attachment at the end for getting the idea).

I am using zsh as shell interpreter. My pc character encoding details is given below:

$ locale -a
C
en_IN
en_IN.utf8
POSIX

Can anyone help me solve this issue please?  I am attaching the outputs below.
0RxywZR.png


PS: The image has been modified using GIMP to erase username and hostname only (Output was not tampered in any way though!). Also as it was cropped from a whole Desktop screenshot to remove unneccecary parts, it was scaled somewhat too. I don't think these will cause any problems as the output is still well understandable but just stating in case some problem arises.

Last edited by nlern (2015-07-25 02:22:45)

Offline

#2 2015-07-21 10:57:10

Awebb
Member
Registered: 2010-05-06
Posts: 6,307

Re: [SOLVED] VNStat Weird Characters in Output

Test vnstat in xterm and a normal tty. If both are fine, then there is a problem with VTE. I've had similar problems in Sakura.

Last edited by Awebb (2015-07-21 10:57:38)

Offline

#3 2015-07-21 11:02:28

nlern
Member
From: West Bengal, India
Registered: 2015-06-29
Posts: 51

Re: [SOLVED] VNStat Weird Characters in Output

@Awebb, weird characters are showing in xterm and other ttys too. So is it because the character it prints out is not included in the fonts I use? I am currently using DejaVu Sans Condensed (Size: 10) as my default font.

Last edited by nlern (2015-07-21 11:06:05)

Offline

#4 2015-07-21 11:59:31

Awebb
Member
Registered: 2010-05-06
Posts: 6,307

Re: [SOLVED] VNStat Weird Characters in Output

The tty does not use those fonts. Try the generic C locale or en_US.utf8 to rule out your locale as the problem.

Offline

#5 2015-07-21 12:36:33

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] VNStat Weird Characters in Output

Awebb wrote:

Try the generic C locale or en_US.utf8 to rule out your locale as the problem.

This.

Since OP has already C locale enabled, he can simply run

LC_ALL=C <command>

to get the output in English.

What's the output of

uname -a
localectl

Similar issue: https://bbs.archlinux.org/viewtopic.php?id=191771 , also en_IN.utf8 locale.

Offline

#6 2015-07-22 16:36:30

nlern
Member
From: West Bengal, India
Registered: 2015-06-29
Posts: 51

Re: [SOLVED] VNStat Weird Characters in Output

Thanks Karol, using your first command I can get desired output.

$ LC_ALL=C vnstat
Database updated: Wed Jul 22 21:52:25 2015

   enp2s0 since 07/02/15

          rx:  50.88 GiB      tx:  8.62 GiB      total:  59.49 GiB

   monthly
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
       Jul '15     50.88 GiB |    8.62 GiB |   59.49 GiB |  263.62 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated     71.98 GiB |   12.19 GiB |   84.17 GiB |

   daily
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     yesterday     75.51 MiB |    9.19 MiB |   84.69 MiB |    8.03 kbit/s
         today    214.15 MiB |   14.08 MiB |  228.23 MiB |   23.74 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated       234 MiB |      15 MiB |     249 MiB |

You wanted some command outputs.

karol wrote:

What's the output of

uname -a
localectl

Following are the command outputs you required.

$ uname -a
Linux *hostname* 3.14.48-1-lts #1 SMP Fri Jul 10 21:13:20 CEST 2015 x86_64 GNU/Linux
$ localectl
    System Locale: LANG=en_IN.UTF-8
       VC Keymap: n/a
      X11 Layout: n/a

EDIT:It is very tiresome job to always use LC_ALL=C before a command to get the desired output. I previously used Ubuntu and there was my locale perfectly configured so vnstat always gave desired output. So I think my locale in Arch Linux is not correctly configured. It will be very helpful if anyone can provide me a way to set correct locale. I will also mark this thread SOLVED after I get the same vnstat output without using LC_ALL=C.

Last edited by nlern (2015-07-22 16:54:45)

Offline

#7 2015-07-22 21:55:41

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] VNStat Weird Characters in Output

You can use an alias to type less.

Offline

#8 2015-07-23 04:55:21

nlern
Member
From: West Bengal, India
Registered: 2015-06-29
Posts: 51

Re: [SOLVED] VNStat Weird Characters in Output

@karol, I want to set the assignment LC_ALL=C globally.

Offline

#9 2015-07-23 07:14:43

Awebb
Member
Registered: 2010-05-06
Posts: 6,307

Re: [SOLVED] VNStat Weird Characters in Output

Export it in bashrc.

Offline

#10 2015-07-23 22:19:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] VNStat Weird Characters in Output

Awebb wrote:

Export it in bashrc.

https://wiki.archlinux.org/index.php/Locale#LC_ALL

Offline

#11 2015-07-25 02:22:21

nlern
Member
From: West Bengal, India
Registered: 2015-06-29
Posts: 51

Re: [SOLVED] VNStat Weird Characters in Output

Thanks Awebb and karol for giving helping me out to solving this problem. I am making an alias for the working command in my shell profile file. I am also marking this thread as solved.

Offline

Board footer

Powered by FluxBB