 |
 |
★ Unicode Characters in Terminal Prompt?‽
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2002
Status:
Offline
|
|
I’ve recently updated my Bash installation to version 3.2.39(1)-release, updated the coreutils and followed the other steps necessary to enable me to type Unicode characters in Terminal, but I haven’t been able to work out how to get ★s, ♥s, s and other symbols to show up in my shell prompt.
Grateful for any suggestions. ☺✌
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Offline
|
|
This isn't really a development issue, so I'm not really sure this is the right forum for it.
However, you can go to Preferences window, then click the Advanced tab, and make sure the encoding is set to UTF-8. This should at least cause filenames to show up correctly when displayed by the 'ls' program. For other cases, it will depend on whether the program outputs in UTF-8 or something else - if a particular tool you're using outputs text in some other encoding, you may want to change the encoding to that instead.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
You don't need to upgrade anything for those to work. You just have to make sure that the font you are using in the teminal supports that character.
If you go to the edit menu and select "Special Characters" you can then use that to "type" them into the terminal window. I was able to find everything but the Apple character (I did not search hard), and using bash all you have to do is:
PS1='<<insert character here>>'
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2002
Status:
Offline
|
|
They do show up correctly. Everywhere, in fact, just not in the shell prompt, where I get two question marks instead of the intended character.
Oddly, pico (the editor I’d been using) let me type in the characters when I was editing my /etc/motd file, but not when editing .bashrc, where I got the ‘??’ again.
Now, I just edited the .bashrc file in TextWrangler, typing in the ★ character, and saving as UTF-8. When I open the file in pico, the character shows correctly in there, but in the prompt it’s ‘??’ instead.
The farthest I’ve gotten with this is typing in the character using the ‘Unicode Hex Input’ layout. This actually gets the ★ character into the prompt, preceded by a question mark and a space I didn’t type. Moreover, doing it this way gets the following printed to the screen before the prompt:
Code:
declare -x CLICOLOR="1"
declare -x HOME="/Volumes/Data/Users/red"
declare -x LC_CTYPE="en_US.UTF-8"
declare -x LSCOLORS="dxfxcxdxbxegedabagacad"
declare -x OLDPWD
declare -x PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/texbin:/usr/local/bin"
declare -x PWD="/Volumes/Data/Users/red"
declare -x SECURITYSESSIONID="20fc50"
declare -x SHELL="/bin/sh"
declare -x SHLVL="1"
declare -x TERM="xterm-color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="100.1.8"
declare -x USER="red"
declare -x __CF_USER_TEXT_ENCODING="0x1F5:0:0"
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Offline
|
|
Putting a star character in the bash prompt works for me:
Then, when opening a new Terminal window, I get:
Code:
Last login: Fri Oct 17 03:33:54 on ttys000
★ echo "hello world"
hello world
★
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2002
Status:
Offline
|
|
Maybe it’s got something to do with my old version of Terminal.
Finally got it working. Opened .bashrc in TextWrangler, switched to Unicode Hex input method, typed ⌥2605 to get the ★ symbol, saved as UTF-8.
Code:
export PS1='\[\e[1;31m\][\A]\[\e[1;35m\][\u]\e[1;32m\][\w]\[\e[0m\]★'
Thanks for the help.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Location: Seattle
Status:
Offline
|
|
Originally Posted by CharlesS
This isn't really a development issue, so I'm not really sure this is the right forum for it.
This forum is where the smart people hang out! 
(Last edited by Gavin; Oct 17, 2008 at 05:27 AM.
)
|
|
You can take the dude out of So Cal, but you can't take the dude outta the dude, dude!
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|