2

I just upgraded to Debian 8 with a fresh install and my terminal prompt (prompt adam2 8bit with ZSH) no longer displays some characters correctly: Missing unicode characters

I've checked the terminal encoding (set to Unicode UTF-8) and the $TERM environment variable (xterm-256color) as well as multiple terminal emulators and fonts, but nothing seems to give me actual unicode characters. Moreover, this happens with a completely bare .zshrc after having issued

    $ autoload -Uz promptinit
    $ promptinit
    $ prompt adam2 8bit

to the terminal. My locale reads

    LANG=en_US.utf8
    LANGUAGE=
    LC_CTYPE="en_US.utf8"
    LC_NUMERIC="en_US.utf8"
    LC_TIME="en_US.utf8"
    LC_COLLATE="en_US.utf8"
    LC_MONETARY="en_US.utf8"
    LC_MESSAGES="en_US.utf8"
    LC_PAPER="en_US.utf8"
    LC_NAME="en_US.utf8"
    LC_ADDRESS="en_US.utf8"
    LC_TELEPHONE="en_US.utf8"
    LC_MEASUREMENT="en_US.utf8"
    LC_IDENTIFICATION="en_US.utf8"
    LC_ALL=
rayhem
  • 121

1 Answers1

1

This is most probably a problem with your $PS1 variable. The $PS1 variable is defined in your zshrc file. This file is located in /etc/zshrc The $PS1 variable stores the encoded (ASCII I believe) information to produce your prompt.
The first thing you want to do is see what your $PS1 is currently. To do this type echo $PS1 in your terminal. The standard prompt for Debian 8 ZSH is %m%#, which equates to hostname% or whatever your hostname happens to be(my prompt is localhost%). Most likely, the reason for your odd terminal prompt is a messed up $PS1 variable, so to change it back to the default Debian 8 ZSH prompt type PS1="%m%#" in your terminal... keep in mind that this is temporary and your prompt will be reset every time you exit the terminal. To make this change permanent open your /etc/zshrc file and append
PS1="%m%#"
to the file. Type exit to close the terminal, and then open it up again. The new, fixed terminal prompt should be displayed.

On a side note

These instructions are for ZSH, not bash! The default prompt for bash in Debian 8 is \u@\H: \w $ which equates to username@hostname: ~ $ (If I was in the /bin directory, my prompt would look like bradleysadowsky@localhost: /bin $). The characters in a ZSH prompt are very different from the characters in the bash prompt. Bash has characters ZSH does not and vice versa. Another key difference is (mostly) in bash, the special $PS1 characters start with a backslash(\), whereas in ZSH (mostly), the special $PS1 characters start with a percent symbol(%) For a good list of the more useful ZSH escape characters go to this webpage. For a comprehensive guide to the $PS1 variable in bash and some escape characters for bash, go to this webpage.

Finally

To set up your own prompt just put those escape characters together in a way you like, and edit your /etc/zshrc adding your prompt to it. A good prompt that is useful and beautiful for ZSH is [%n@%m] %~> which is equivalent to [username@hostname] ~>, so for me (if I was in /bin) [bradleysadowsky@localhost] /bin>.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
  • 3
    I don't understand how this answer is supposed to relate to the question. It appears to just be miscellaneous information about customising your prompt that doesn't have much to do with solving the OP's problem. – Chris Down Jun 24 '15 at 15:38
  • I actually don't "manually" set a PS1 variable anywhere; ZSH comes with a prompt command to view/set/customize a number of defaults. prompt adam2 works fine for me, but prompt adam2 8bit (with the box-drawing characters) gives the glyph-not-found question marks. – rayhem Jun 24 '15 at 15:38
  • @ Connor Glosser: I believe the solution (I am not an expert at ZSH, although something like this has worked for me in the past) is to simply run prompt adam2 8bit and then echo $PS1... set that to your PS1 manually, (to identify if this is an error with ZSH or and error with the prompt command), and if it works, then great, if not, then try looking for errors within that particular set of escape characters... Hopefully this will fix it... –  Jun 24 '15 at 15:58