dalance / procs

A modern replacement for ps written in Rust
MIT License
5.13k stars 116 forks source link

Escaped characters(?) in output for PID and CPU. #21

Closed bdmorin closed 5 years ago

bdmorin commented 5 years ago

image

I'm getting odd escaped characters or something in my output for PID and CPU columns. Unsure where to start to troubleshoot this.

bdmorin@phester:~$ locale
LANG=en_US.UTF-8
LANGUAGE=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
dalance commented 5 years ago

Could you explain your environment? Especially terminal emulator.

bdmorin commented 5 years ago

yeah, after I hit submit I realized should've done this.

bdmorin@phester:~$ screenfetch
                          ./+o+-       bdmorin@phester
                  yyyyy- -yyyyyy+      OS: Ubuntu 19.04 disco
               ://+//////-yyyyyyo      Kernel: x86_64 Linux 5.0.0-25-generic
           .++ .:/++++++/-.+sss/`      Uptime: 1d 10h 41m
         .:++o:  /++++++++/:--:/-      Packages: 3539
        o:+o+:++.`..```.-/oo+++++/     Shell: bash 5.0.3
       .:+o:+o/.          `+sssoo+/    Resolution: 1920x1080
  .++/+:+oo+o:`             /sssooo.   DE: GNOME 
 /+++//+:`oo+o               /::--:.   WM: GNOME Shell
 \+/+o+++`o++o               ++////.   WM Theme: Arc-Dark
  .++.o+++oo+:`             /dddhhh.   GTK Theme: Arc-Dark [GTK2/3]
       .+.o+oo:.          `oddhhhh+    Icon Theme: Papirus-Dark
        \+.++o+o``-````.:ohdhhhhh+     Font: Ubuntu 11
         `:o+++ `ohhhhhhhhyo++os:      CPU: Intel Core i7-9750H @ 12x 4.5GHz [64.0°C]
           .o:`.syhhhhhhh/.oo++o`      GPU: GeForce RTX 2060
               /osyyyyyyo++ooo+++/     RAM: 4428MiB / 31876MiB
                   ````` +oo+++o\:    
                          `oo++.      
bdmorin@phester:~$ env | fgrep -i term
COLORTERM=truecolor
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/816aed81_859c_4c68_b830_9baaca3902b4
TERM=xterm-256color
GNOME_TERMINAL_SERVICE=:1.257
ZSH_TMUX_TERM=screen-256color
bdmorin commented 5 years ago

wider view, but obviously the same result.

image

I also tried this on a remote host, with

env | fgrep -i term
TERM=xterm

same behaviour

dalance commented 5 years ago

The characters seems to be unicode character like │, ▲. Please check gnome terminal setting: Terminal -> Set Character Encoding -> UTF-8.

bdmorin commented 5 years ago

image

Hmm.. I think it's set like that now. I'm installing alacritty/kitty now, a different term emulator.

dalance commented 5 years ago

Can your terminal show "▲"?

bdmorin commented 5 years ago

i copied that character and pasted it in my terminal, it seemed to work.

dalance commented 5 years ago

Could you try procs --pager disable?

bdmorin commented 5 years ago

Welp.. That did it. image

❯ env | rg -i less     
LESS=-iRFXMx4
LESSOPEN=| /usr/bin/env lesspipe %s 2>&-
❯ unset LESS      
❯ unset LESSOPEN
❯ env | rg -i less

After clearing these the same thing still happened. I'll look further at my pager settings.

dalance commented 5 years ago

procs doesn't check LESS environment variable. If less command exists, less -SR is used.

dalance commented 5 years ago

It is wrong. LESS is used by less. What is your less version?

dalance commented 5 years ago

I found the similar issue. https://serverfault.com/questions/414760/how-to-make-the-less-command-handle-utf-8

Could you try below?

export LESSCHARSET=utf-8
bdmorin commented 5 years ago
❯ less -V             
less 487 (GNU regular expressions)
Copyright (C) 1984-2016  Mark Nudelman
export LESSCHARSET=utf-8

That did it!! YAY!

Thanks! I love procs!

dalance commented 5 years ago

Thanks!

bergercookie commented 5 years ago

Thanks for solving this, had the exact same issue with the same less version on Ubuntu 18. Probably a note in the README file would help future ubuntu users.

Great software by the way, thanks for open-sourcing it.

dalance commented 5 years ago

Thank you for your comment. I added installation note.

lightonflux commented 4 years ago

Is there a reason why this is not a default? Maybe we can create a bug report for Ubuntu or upstream less, so that this does not need to be changed. I don't really see a downside of using utf-8.

dalance commented 4 years ago

I don't know the reason. But It seems to be intended by the author bacause there is the solution using LESSCHARSET in the official FAQ. http://greenwoodsoftware.com/less/faq.html#intl