2

I'm pretty certain this is some foible of my SSH client (RoyalTS for Windows) but, having just installed and changed to fish shell, my prompt is preceded by two dark-grey ⎠characters.

It doesn't seem to do it in PuTTY, just in this particular client, which uses a Rebex plugin.

The fish FAQ talks about random characters and mentions a fish_title function, which it tells you how to empty, but this does not seem to have made a difference.

I'm sure they are just some sort of mis-encoded control characters, but I'm just trying to work out what these two characters are, what they are for and how I might get rid of them.

Edit

As requested, the output of fish_prompt hasn't changed since install, and is:

function fish_prompt --description 'Write out the prompt'
    # Just calculate this once, to save a few cycles when displaying the prompt
    if not set -q __fish_prompt_hostname
            set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
    end

    set -l color_cwd
    set -l suffix
    switch $USER
    case root toor
            if set -q fish_color_cwd_root
                    set color_cwd $fish_color_cwd_root
            else
                    set color_cwd $fish_color_cwd
            end
            set suffix '#'
    case '*'
            set color_cwd $fish_color_cwd
            set suffix '>'
    end

    echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
end

...and fish_prompt | xxd:

0000000: 726f 6f74 4063 616e 6463 2d77 6230 3170  root@candc-wb01p
0000010: 2d6c 201b 5b33 316d 2f1b 5b33 306d 1b28  -l .[31m/.[30m.(
0000020: 421b 5b6d 2320                           B.[m#

...and functions -an:

# functions -an
., N_, _, __fish_append, __fish_bind_test1, __fish_bind_test2, 
__fish_command_not_found_setup, __fish_commandline_test, 
__fish_complete_abook_formats, __fish_complete_ant_targets, 
__fish_complete_atool, __fish_complete_atool_archive_contents, 
__fish_complete_aura, __fish_complete_bittorrent, 
__fish_complete_cabal, __fish_complete_cd, __fish_complete_command, 
__fish_complete_convert_options, __fish_complete_diff, 
__fish_complete_directories, __fish_complete_file_url, 
__fish_complete_ftp, __fish_complete_grep, __fish_complete_groups, 
__fish_complete_list, __fish_complete_lpr, __fish_complete_lpr_option, 
__fish_complete_ls, __fish_complete_lsusb, __fish_complete_man, 
__fish_complete_mime, __fish_complete_pacman, __fish_complete_path, 
__fish_complete_pgrep, __fish_complete_pids, __fish_complete_ppp_peer, 
__fish_complete_proc, __fish_complete_python, 
__fish_complete_service_actions, __fish_complete_setxkbmap, 
__fish_complete_ssh, __fish_complete_subcommand, 
__fish_complete_subcommand_root, __fish_complete_suffix, 
__fish_complete_svn, __fish_complete_svn_diff, __fish_complete_tar, 
__fish_complete_tex, __fish_complete_unrar, __fish_complete_users, 
__fish_complete_vi, __fish_complete_wvdial_peers, __fish_complete_xsum, 
__fish_config_interactive, __fish_contains_opt, __fish_crux_packages, 
__fish_cursor_konsole, __fish_cursor_xterm, 
__fish_default_command_not_found_handler, __fish_describe_command, 
__fish_filter_ant_targets, __fish_filter_mime, __fish_git_prompt, 
__fish_gnu_complete, __fish_hg_prompt, __fish_is_first_token, 
__fish_is_token_n, __fish_list_current_token, 
__fish_make_completion_signals, __fish_man_page, __fish_move_last, 
__fish_no_arguments, __fish_not_contain_opt, 
__fish_number_of_cmd_args_wo_opts, __fish_paginate, __fish_ports_dirs, 
__fish_print_abook_emails, __fish_print_addresses, 
__fish_print_arch_daemons, __fish_print_cmd_args, 
__fish_print_cmd_args_without_options, __fish_print_commands, 
__fish_print_debian_services, __fish_print_encodings, 
__fish_print_filesystems, __fish_print_function_prototypes, 
__fish_print_help, __fish_print_hostnames, __fish_print_interfaces, 
__fish_print_lpr_options, __fish_print_lpr_printers, 
__fish_print_lsblk_columns, __fish_print_make_targets, 
__fish_print_mounted, __fish_print_packages, 
__fish_print_service_names, __fish_print_svn_rev, __fish_print_users, 
__fish_print_xdg_mimeapps, __fish_print_xdg_mimetypes, 
__fish_print_xrandr_modes, __fish_print_xrandr_outputs, 
__fish_print_xwindows, __fish_prt_no_subcommand, __fish_prt_packages, 
__fish_prt_ports, __fish_prt_use_package, __fish_prt_use_port, 
__fish_pwd, __fish_reconstruct_path, __fish_reload_key_bindings, 
__fish_repaint, __fish_repaint_root, __fish_restore_status, 
__fish_seen_subcommand_from, __fish_systemctl_automounts, 
__fish_systemctl_devices, __fish_systemctl_mounts, 
__fish_systemctl_scopes, __fish_systemctl_service_paths, 
__fish_systemctl_services, __fish_systemctl_slices, 
__fish_systemctl_snapshots, __fish_systemctl_sockets, 
__fish_systemctl_swaps, __fish_systemctl_targets, 
__fish_systemctl_timers, __fish_test_arg, __fish_urlencode, 
__fish_use_subcommand, __fish_winch_handler, __terlar_git_prompt, abbr, 
alias, cd, contains_seq, cp, delete-or-exit, dirh, dirs, 
down-or-search, eval, export, fish_config, fish_default_key_bindings, 
fish_indent, fish_mode_prompt, fish_prompt, fish_sigtrap_handler, 
fish_update_completions, fish_vi_cursor, fish_vi_key_bindings, 
fish_vi_mode, funced, funcsave, grep, help, history, hostname, isatty, 
la, ll, ls, man, math, mcd, mimedb, mv, nextd, nextd-or-forward-word, 
open, popd, prevd, prevd-or-backward-word, prompt_pwd, psub, pushd, rm, 
seq, setenv, sgrep, trap, type, umask, up-or-search, vared,
  • Anything in your .profile (.bashrc, .bash_profile, .login, etc.) which sets the prompt and has embedded control characters? – EightBitTony Jun 3 '16 at 14:10
  • I can't see anything in the places you've mentioned, nor in ~/.config/fish/* -- would fish even use the bash-based ones? – jimbobmcgee Jun 3 '16 at 14:14
  • Ah my bad, didn't read properly, thought fish was your ssh client. So I'm guessing somewhere in the fish shell config it's setting the prompt or similar to have some control characters which PuTTY happily interprets but RoyalTS doesn't. Maybe check the term settings in RoyalTS, or dig further into fish (I have no experience of it) – EightBitTony Jun 3 '16 at 14:16
  • Looks like a locale problem between your ssh client and the shell. Check your shell's $LANG and $LC* variables, and the client's settings. – glenn jackman Jun 3 '16 at 14:24
  • What's the output of: functions fish_prompt ? – Jeff Schaller Jun 3 '16 at 15:00
4

I'm sure they are just some sort of mis-encoded control characters, but I'm just trying to work out what these two characters are,

⎠is what happens when one displays the transmitted octets \xc2 \x8e decoded with Windows code page 1252. Your terminal emulator is using a single-byte character set.

Decoded as UTF-8, rather, that is the SS2 control character.

So you have: something on the host end that thinks that it needs to send ISO 2022 control sequences to switch 7-bit character sets, even though (quite ironically) it's encoding those control sequences in UTF-8; and a terminal emulator that isn't speaking UTF-8.

There's more ISO 2022 in the prompt string that you hex-dumped. \x1b \x28 \x42 is where your shell (apparently in its set_color normal command) sent the ISO 2022-JP sequence to switch to ASCII.

The simplest cure is this: Make your terminal emulator speak UTF-8. Stop your host programs thinking that they need to do any sort of ISO 2022 character set switching at all and tell them to just speak UTF-8 too.

You might want to check your terminal type, too. Your terminal type (sent originally from your terminal emulation program to your host) must match the actual behaviour of your terminal emulation program. Making "But it's xterm, right?" decisions, or just picking arbitrary terminal types, rarely works well.

The right terminal type for PuTTY is in fact something like putty or putty-256color or putty-sco for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.