Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII

Liste des GroupesRevenir à cu shell 
Sujet : Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII
De : flexibeast (at) *nospam* gmail.com (Alexis)
Groupes : comp.unix.shell
Date : 15. May 2025, 07:08:19
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87wmaixv70.fsf@gmail.com>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Gnus/5.13 (Gnus v5.13)
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

Concerning portability the question in the first place is IMO what to
do with those '\u....' . - I don't think this is standard, or is it?
>
So if it's non-standard we could use arbitrary common but non-standard
shell features.
>
Like the shell built-in 'printf' without $'...' to use just '...'.
Or IMO best just the already suggested ANSI strings  var=$'...' .

The 'echo' utility as specified by the current version of POSIX,
POSIX-1.2024, isn't required to support the '\u...' sequence:

  https://pubs.opengroup.org/onlinepubs/9799919799/utilities/echo.html#tag_20_37_04

Nor is the 'printf' utility:

  https://pubs.opengroup.org/onlinepubs/9799919799/utilities/printf.html#tag_20_96

and OpenBSD Ksh doesn't support using that sequence in an argument to
its 'echo' builtin.

Additionally, this version of POSIX added dollar-single quotes to the
standard:

  A sequence of characters starting with a <dollar-sign> immediately
  followed by a single-quote ($') shall preserve the literal value of
  all characters up to an unescaped terminating single-quote (')

  -- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_02_04

However, although it's supported by Bash, ATT Ksh, and Zsh, it doesn't
seem to be supported by Dash (as of version 0.5.12):

  $ eg=$'\n'
  $ printf '%s' "${eg}" | od -c
  0000000   $   \   n
  0000003
  $

or by OpenBSD Ksh (as of the version included in OpenBSD 7.6; not sure
about its status in 7.7):

  $ eg=$'\n'
  $ printf '%s' "${eg}" | od -c
  0000000    $   \   n                                                   
  0000003
  $

(i should probably add a table about this to a page on the Gentoo wiki
that i've been slowly working on,
https://wiki.gentoo.org/wiki/Shell/Scripting )


Alexis.

Date Sujet#  Auteur
4 May 25 * How to convert <binaryGlowMixedWithASCII> to pure ASCII25Kenny McCormack
4 May 25 +* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII6Lew Pitcher
4 May 25 i+* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII3Kenny McCormack
4 May 25 ii`* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII2John-Paul Stewart
4 May 25 ii `- Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII1Kenny McCormack
5 May 25 i`* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII2Eli the Bearded
5 May 25 i `- Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII1Janis Papanagnou
12 May 25 `* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII18Chuck Martin
12 May 25  `* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII17Kenny McCormack
12 May 25   `* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII16Nuno Silva
12 May 25    +* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII14Kenny McCormack
12 May 25    i`* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII13Chris Elvidge
14 May 25    i `* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII12Brian Patrie
14 May 25    i  `* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII11Chris Elvidge
14 May 25    i   `* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII10Kaz Kylheku
14 May 25    i    +* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII7Janis Papanagnou
15 May 25    i    i`* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII6Alexis
15 May 25    i    i +- Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII1Janis Papanagnou
21 May 25    i    i `* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII4Lars Poulsen
22 May 25    i    i  `* Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII3Lawrence D'Oliveiro
22 May 25    i    i   +- Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII1Kaz Kylheku
22 May 25    i    i   `- Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII1Keith Thompson
15 May 25    i    +- Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII1Brian Patrie
15 May 25    i    `- Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII1Geoff Clare
12 May 25    `- Re: How to convert <binaryGlowMixedWithASCII> to pure ASCII1Eli the Bearded

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal