Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: bash prints numeric values of unicode characters instead of their UTF8 representations Date: Wed, 3 Feb 2016 16:13:49 -0500 Lines: 26 Approved: bug-bash@gnu.org Message-ID: References: <56AE7F6E.3040406@rawbw.com> <56B2611E.2060802@rawbw.com> Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1454534046 5565 208.118.235.17 (3 Feb 2016 21:14:06 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu To: Yuri , bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: <56B2611E.2060802@rawbw.com> X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.56B26D8E.0161,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2015-08-12 04:07:17, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: b00b798a96f527a0dea179b0329798bd X-Junkmail-Whitelist: YES (by domain whitelist at mpv1-2015.case.edu) X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.56B26D8F.00AA,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2015-08-12 04:07:17, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: fd667617464d37d3af68710a98e346fb X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 129.22.103.226 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:12300 On 2/3/16 3:20 PM, Yuri wrote: > On 01/31/2016 13:41, Yuri wrote: >> I have this line in ~/.bashrc: >> PS1=$'\\[\e[0;38;5;202m\\]\u2514\u2023\\[\e[0m\\] ' > > This link > http://unix.stackexchange.com/questions/25903/awesome-symbols-and-characters-in-a-bash-prompt > says: "Since bash 4.2, you can use \u followed by 4 hexadecimal digits in a > $'…' string". > My bash-4.3.42 misinterprets \u as the user name instead. > > So what could be wrong? Is \u supposed to be a user name or a unicode > codepoint hexadecimal prefix? Sigh. You are mixing two things that perform backslash-escape character processing. If there is no character corresponding to a particular unicode value in the current character set, the escape sequence is left unchanged. So you get through a round of expansion with the $'...' processing, and the \u2514 is preserved in the result. The PS1 expansion code sees the \u and turns it into the current username. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/