[Tcsh] "Readable" Unicode in setenv
Christos Zoulas
christos at zoulas.com
Mon Nov 15 16:33:55 UTC 2021
> On Nov 15, 2021, at 9:34 AM, H.Merijn Brand <tcsh at tux.freedom.nl> wrote:
>
> Signed PGP part
> On Mon, 15 Nov 2021 08:15:57 -0500, Christos Zoulas <christos at zoulas.com> wrote:
>
>>> On Nov 14, 2021, at 8:29 AM, H.Merijn Brand <tcsh at tux.freedom.nl> wrote:
>>>
>>> Signed PGP part
>>> On Sat, 13 Nov 2021 19:16:07 -0500, Christos Zoulas <christos at zoulas.com <mailto:christos at zoulas.com>> wrote:
>>>
>>>> Committed, thanks!
>>>
>>> Wow, thanks. Would it be hard(er) to also allow
>>>
>>> % setenv EURO "\u20AC"
>>>
>>> directly too instead of
>>>
>>> % setenv EURO `echo "\u20AC"`
>>>
>>> (you can also hint me to the location in/of the code and I'll play around myself)
>>>
>>
>> I am not sure... How do you enter a literal "\u20AC" then in the environment?
>> setenv EURO "\\u20AC"?
>
> Use single quotes, but yeah, that might confuse Windows users
>
> To me
>
> % setenv EURO "\u20AC"
> % env | grep EURO => €
>
> % setenv EURO '\u20AC'
> % env | grep EURO => \u20AC
>
> would be intuitive, but I have a strong perl-background, so that might explain.
>
>> Does not seem very intuitive to me. At least we have simple "output" semantics
>> here for echo. What would be the "input" semantics, and which commands do they
>> affect? I.e. does the translation happen for all variables on assignment? For all
>> literal strings present in csh code?
>
> Yes, for all double-quoted literal strings in csh code (maybe that could be an option)
> No, for all single-quoted literal strings in csh code
>
> braindump:
>
> % set literal_escapes=U
> "\u20AC" => €
> "\x{20AC}" => \x{20AC}
> "\101" => \101
>
> % set literal_escapes=X
> "\u20AC" => \u20AC
> "\x{20AC}" => €
> "\101" => \101
>
> % set literal_escapes=UXO
> "\u20AC" => €
> "\x{20AC}" => €
> "\101" => A
That is perhaps workable, but how about:
set x=\\u20AC
I mean, quotes are optional for strings in shell, and that makes life complicated :-)
christos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20211115/fab98784/attachment.asc>
More information about the Tcsh
mailing list