Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

No one wants war. -- Kirk, "Errand of Mercy", stardate 3201.7


devel / comp.unix.shell / Re: How do I escape a string that contains both single and double quotes?

SubjectAuthor
* How do I escape a string that contains both single and double quotes?Ottavio Caruso
+- Re: How do I escape a string that contains both single and doubleJanis Papanagnou
+- Re: How do I escape a string that contains both single and doubleChristian Weisgerber
+* Re: How do I escape a string that contains both single and doubleEd Morton
|+- Re: How do I escape a string that contains both single and doubleEd Morton
|+* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||+* Re: How do I escape a string that contains both single and doubleEd Morton
|||`* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||| `* Re: How do I escape a string that contains both single and doubleEd Morton
|||  `* "od" not a mandatory part of the POSIX standard? (was: How do I escape a string Helmut Waitzmann
|||   `- Re: "od" not a mandatory part of the POSIX standard? (was: How do IEd Morton
||+* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
|||`* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||| +* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
||| |+- Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||| |`- Re: How do I escape a string that contains both single and double quotes?Keith Thompson
||| +* Re: How do I escape a string that contains both single and doubleChristian Weisgerber
||| |+* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||| ||`- Re: How do I escape a string that contains both single and doubleChristian Weisgerber
||| |`* Re: How do I escape a string that contains both single and doubleWayne
||| | `- Re: How do I escape a string that contains both single and doubleChristian Weisgerber
||| `- Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
||`- Re: How do I escape a string that contains both single and doubleChristian Weisgerber
|`* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
| +* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| |+* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
| ||`- Re: How do I escape a string that contains both single and double quotes?Andreas Eder
| |`* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| | +* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
| | |`- Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| | `* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| |  `* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| |   `* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| |    `* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| |     `* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| |      `* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| |       `- Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| `- Re: How do I escape a string that contains both single and doubleEd Morton
`* Re: How do I escape a string that contains both single and doubleJorgen Grahn
 +* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
 |`* Re: How do I escape a string that contains both single and double quotes?Helmut Waitzmann
 | `- Re: How do I escape a string that contains both single and doubleJanis Papanagnou
 `* Re: How do I escape a string that contains both single and doubleOttavio Caruso
  `* Re: How do I escape a string that contains both single and doubleJorgen Grahn
   `- Re: How do I escape a string that contains both single and doubleOttavio Caruso

Pages:12
Re: How do I escape a string that contains both single and double quotes?

<t143c8$iha$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5117&group=comp.unix.shell#5117

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: way...@nospam.invalid (Wayne)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sat, 19 Mar 2022 04:13:58 -0400
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <t143c8$iha$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me> <slrnt39aj5.23ts.naddy@lorvorc.mips.inka.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 19 Mar 2022 08:14:00 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="98db1331eb6dc3bfbfb8df77bbf3eda9";
logging-data="18986"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Laepu8o9JN6vtmvXcCFdyo0u7YlRXVF4="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:OLhUNMcCdLOplf6NZhRYh37gEvU=
In-Reply-To: <slrnt39aj5.23ts.naddy@lorvorc.mips.inka.de>
Content-Language: en-US
 by: Wayne - Sat, 19 Mar 2022 08:13 UTC

On 3/18/2022 11:51 AM, Christian Weisgerber wrote:
> On 2022-03-17, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>
> ...
> fold.c did however ship with 1BSD. (It's in s6/cont.a.)
>

Is that the same fold command though? It's been a very long time
but I still remember the original fold command inserted DEL bytes
every 6 inches, to allow folding of the paper tape from an ASR-33!
I don't know if that was the fold.c in BSD though.

--
Wayne

Re: How do I escape a string that contains both single and double quotes?

<slrnt3blh4.2san.naddy@lorvorc.mips.inka.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5118&group=comp.unix.shell#5118

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: nad...@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sat, 19 Mar 2022 13:09:56 -0000 (UTC)
Message-ID: <slrnt3blh4.2san.naddy@lorvorc.mips.inka.de>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me> <slrnt39aj5.23ts.naddy@lorvorc.mips.inka.de>
<t143c8$iha$1@dont-email.me>
Injection-Date: Sat, 19 Mar 2022 13:09:56 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="94552"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Sat, 19 Mar 2022 13:09 UTC

On 2022-03-19, Wayne <wayne@nospam.invalid> wrote:

>> fold.c did however ship with 1BSD. (It's in s6/cont.a.)
>
> Is that the same fold command though?

Yes.

Here's the initial version from the Git conversion of the CSRG's
SCCS repository:
https://github.com/jonathangray/csrg/commit/f4a92b564ec31c3fae61558c8fbcd913cace1ad1

It didn't really change until Kevin Ruddy rewrote it in 1990.

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Re: How do I escape a string that contains both single and double quotes?

<slrnt3bkuj.2san.naddy@lorvorc.mips.inka.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5119&group=comp.unix.shell#5119

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: nad...@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sat, 19 Mar 2022 13:00:03 -0000 (UTC)
Message-ID: <slrnt3bkuj.2san.naddy@lorvorc.mips.inka.de>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me> <slrnt39aj5.23ts.naddy@lorvorc.mips.inka.de>
<t131qh$4rk$1@dont-email.me>
Injection-Date: Sat, 19 Mar 2022 13:00:03 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="94552"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Sat, 19 Mar 2022 13:00 UTC

On 2022-03-18, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

>> There is no fold(1) command.
>>
>> fold.c did however ship with 1BSD. (It's in s6/cont.a.)
>
> When was that? (Must have been before 1984, I'd have to suppose.)

Late 1977/early 1978.

"The UNIX system family tree: Research and BSD"
https://cgit.freebsd.org/src/tree/share/misc/bsd-family-tree
(Scroll down a few hundred lines, there's more after the spaghetti
graphic.)

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Re: How do I escape a string that contains both single and double quotes?

<slrnt3buc5.1rfm.grahn+nntp@frailea.sa.invalid>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5120&group=comp.unix.shell#5120

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: grahn+n...@snipabacken.se (Jorgen Grahn)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: 19 Mar 2022 15:40:53 GMT
Lines: 36
Message-ID: <slrnt3buc5.1rfm.grahn+nntp@frailea.sa.invalid>
References: <t0v1pl$b1d$1@dont-email.me>
<slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid>
<t11qkq$2go$1@dont-email.me>
X-Trace: individual.net fzKjsBtam9rtDjxwfuUR8wZogTe9eQAmtoSbdIPlVoWM5HiEPd
Cancel-Lock: sha1:YK+NTGa3BMtcevbvDLCaogR/G+0=
User-Agent: slrn/1.0.3 (OpenBSD)
 by: Jorgen Grahn - Sat, 19 Mar 2022 15:40 UTC

On Fri, 2022-03-18, Ottavio Caruso wrote:
> On 18/03/2022 08:28, Jorgen Grahn wrote:
>> If your cw-sort function read from stdin instead, could you still fit
>> it into your workflow? I'm assuming you're normally calling it from
>> some larger script.
>
> No, I call it from the shell.
>
> This is supposed to check the frequency of mistakes I make while
> learning Morse code on lcwo.net.

So, do you then paste the input from some web page? In that case I'd
personally prefer:

% cw-sort
*paste*
<EOF>

to

% cw-sort *paste*

followed by manual escaping and quoting.

But oh, maybe that's what you were asking for: a simple one-size-
fits-all way you can do that without thinking. I have always assumed
there is no such thing, so I didn't even read the responses which went
into quoting.

If there was such a thing, I would consider using it.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

Re: How do I escape a string that contains both single and double quotes?

<t151m8$4ie$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5121&group=comp.unix.shell#5121

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sat, 19 Mar 2022 17:51:20 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <t151m8$4ie$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 19 Mar 2022 16:51:20 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2aada57d99ef47884408e415c4bdab4c";
logging-data="4686"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182Leu2UPccdWR6AQCGARNx"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:+nxDOCywyo1jn/c++afIrG/QP0k=
In-Reply-To: <t0vf8p$pv8$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Sat, 19 Mar 2022 16:51 UTC

On 17.03.2022 15:06, Ed Morton wrote:
>[...]
>
> If your grep version doesn't have a `-o` option then you could instead
> use either of:
>
> printf ... | fold -w1 | sort ...

I just noticed that my fold command doesn't respect the locale settings.

$ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
S


g e
$ echo Säge | LC_ALL=C fold -w 1
S


g e

In a de_DE.UTF-8 locale the umlauts aren't handled properly, which makes
it pretty useless. :-(

Or is my fold version too old?

$ fold --version
fold (GNU coreutils) 8.13

> printf ... | awk '{for (i=1;i<=length();i++) print substr($0,i,1)}'
> | sort

BTW, with GNU awk, setting FS="" you can use $i instead of substr(...).

Janis

Re: How do I escape a string that contains both single and double quotes?

<op.1jahfniqa3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5122&group=comp.unix.shell#5122

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sat, 19 Mar 2022 13:56:01 -0400
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="328d539a443ba8eb8e02ae85b81cdb19";
logging-data="5860"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mjjSF7SEfUlG0Z3tpIt8HV6oJlnhZPI8="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:cVv62Ly6iKt78gFD5qi+V+WFOWo=
 by: David W. Hodgins - Sat, 19 Mar 2022 17:56 UTC

On Sat, 19 Mar 2022 12:51:20 -0400, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

> I just noticed that my fold command doesn't respect the locale settings.
>
> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
> S
>
> �
> g
> e
> $ echo Säge | LC_ALL=C fold -w 1
> S
>
> �
> g
> e
>
> In a de_DE.UTF-8 locale the umlauts aren't handled properly, which makes
> it pretty useless. :-(
>
> Or is my fold version too old?
>
> $ fold --version
> fold (GNU coreutils) 8.13

$ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
S ä
g e
$ fold --version
fold (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

I'm using Mageia 8 with all of it's locale packages installed, and most of it's
fonts.

Regards, Dave Hodgins

Re: How do I escape a string that contains both single and double quotes?

<t15jna$t65$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5124&group=comp.unix.shell#5124

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortons...@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sat, 19 Mar 2022 16:59:06 -0500
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <t15jna$t65$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 19 Mar 2022 21:59:06 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="9214b88ede3fbe38b66a8d79300464bc";
logging-data="29893"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mm0YjdSXH+OgUKlrjLQ5a"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:OFPmba7X1VGWpjSXPL3/JA/HpmM=
In-Reply-To: <t151m8$4ie$1@dont-email.me>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 220319-4, 3/19/2022), Outbound message
 by: Ed Morton - Sat, 19 Mar 2022 21:59 UTC

On 3/19/2022 11:51 AM, Janis Papanagnou wrote:
> On 17.03.2022 15:06, Ed Morton wrote:
>> [...]
>>
>> If your grep version doesn't have a `-o` option then you could instead
>> use either of:
>>
>> printf ... | fold -w1 | sort ...
>
> I just noticed that my fold command doesn't respect the locale settings.
>
> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
> S
>
> �
> g
> e
> $ echo Säge | LC_ALL=C fold -w 1
> S
>
> �
> g
> e
>
> In a de_DE.UTF-8 locale the umlauts aren't handled properly, which makes
> it pretty useless. :-(
>
> Or is my fold version too old?

No idea.

> $ fold --version
> fold (GNU coreutils) 8.13
>
>
>> printf ... | awk '{for (i=1;i<=length();i++) print substr($0,i,1)}'
>> | sort
>
> BTW, with GNU awk, setting FS="" you can use $i instead of substr(...).

I know, I just wanted to provide a final "if all else fails" option
that'd work anywhere and setting FS="" is undefined behavior per POSIX.

Ed.

> Janis
>

Re: How do I escape a string that contains both single and double quotes?

<t16126$a48$2@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5128&group=comp.unix.shell#5128

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sun, 20 Mar 2022 02:46:46 +0100
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <t16126$a48$2@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me> <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 20 Mar 2022 01:46:46 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="264de471b643a9b4fa6e08239b6feb4a";
logging-data="10376"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kwvKyx02Dlg6ijsJlRT+Y"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:N9gb0ywK9cYiwBnO9x8Cbz6LK4o=
In-Reply-To: <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
 by: Janis Papanagnou - Sun, 20 Mar 2022 01:46 UTC

On 19.03.2022 18:56, David W. Hodgins wrote:
> On Sat, 19 Mar 2022 12:51:20 -0400, Janis Papanagnou
> <janis_papanagnou@hotmail.com> wrote:
>
>> I just noticed that my fold command doesn't respect the locale settings.
>>
>> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
>> [...]
>> In a de_DE.UTF-8 locale the umlauts aren't handled properly, which makes
>> it pretty useless. :-(
>>
>> Or is my fold version too old?
>>
>> $ fold --version
>> fold (GNU coreutils) 8.13
>
> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
> S
> ä
> g
> e
> $ fold --version
> fold (GNU coreutils) 8.32
> [...]

Ah, fine, so that seems to have gotten fixed. Thanks!

Janis

Re: How do I escape a string that contains both single and double quotes?

<878rt5ntki.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5130&group=comp.unix.shell#5130

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Sun, 20 Mar 2022 04:20:29 +0000
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <878rt5ntki.fsf@bsb.me.uk>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me>
<op.1jahfniqa3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="676fdda65164f3a38beba70df3828b88";
logging-data="17493"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19J0ESLxQREieYR0+Bmjq59iWRof+TaaKM="
Cancel-Lock: sha1:r/gcrk3FY/Gl7Bjp25V9YvBV6aE=
sha1:gQE5n47bPGyVIf5vSgv5YkWEjL8=
X-BSB-Auth: 1.66b3524ada6415f8833a.20220320042029GMT.878rt5ntki.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 20 Mar 2022 04:20 UTC

"David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

> On Sat, 19 Mar 2022 12:51:20 -0400, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>
>> I just noticed that my fold command doesn't respect the locale settings.
>>
>> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
>> S
>>
>> �
>> g
>> e
>> $ echo Säge | LC_ALL=C fold -w 1
>> S
>>
>> �
>> g
>> e
>>
>> In a de_DE.UTF-8 locale the umlauts aren't handled properly, which makes
>> it pretty useless. :-(
>>
>> Or is my fold version too old?
>>
>> $ fold --version
>> fold (GNU coreutils) 8.13
>
> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
> S
> ä
> g
> e
> $ fold --version
> fold (GNU coreutils) 8.32
> Copyright (C) 2020 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by David MacKenzie.
>
> I'm using Mageia 8 with all of it's locale packages installed, and most of it's
> fonts.

Hmm... I have 8.32 but

$ echo Säge | LC_ALL=en_GB.UTF-8 fold -w 1
S �

g e
$ echo Säge | LC_ALL=en_GB.UTF-8 wc -m
5 $

(That last one just to show that some utilities do get UTF-8 characters
right).

--
Ben.

Re: How do I escape a string that contains both single and double quotes?

<t16c9r$rbb$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5131&group=comp.unix.shell#5131

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sun, 20 Mar 2022 05:58:35 +0100
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <t16c9r$rbb$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me> <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
<878rt5ntki.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 20 Mar 2022 04:58:35 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="264de471b643a9b4fa6e08239b6feb4a";
logging-data="28011"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/AyeRraGZs/VN2YIu57Vi"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:soReTiDLgqv3eqDbQLn5EezihqI=
In-Reply-To: <878rt5ntki.fsf@bsb.me.uk>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Sun, 20 Mar 2022 04:58 UTC

On 20.03.2022 05:20, Ben Bacarisse wrote:
> "David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:
>>
>> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
>> S
>> ä
>> g
>> e
>
> $ echo Säge | LC_ALL=en_GB.UTF-8 fold -w 1
> S
> �
> �
> g
> e
> $ echo Säge | LC_ALL=en_GB.UTF-8 wc -m
> 5
> $
>
> (That last one just to show that some utilities do get UTF-8 characters
> right).

My first thought was that lang:EN would not need to know an Umlaut
character (so it would interpret the two-octet character as binary);
i.e. a semantical interpretation, not a technical (encoding) one.

Is the language the determining factor or the character set encoding?

Janis, puzzled

Re: How do I escape a string that contains both single and double quotes?

<87r16xrp53.fsf@eder.anydns.info>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5132&group=comp.unix.shell#5132

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: a_eder_...@web.de (Andreas Eder)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Sun, 20 Mar 2022 09:42:32 +0100
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <87r16xrp53.fsf@eder.anydns.info>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me> <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
<t16126$a48$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="5dfdfe27bd071171495da100859a2b8d";
logging-data="7008"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3gUR5XNDM92XOhwY2e4tb"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:7vvnJwnCsotHjkpgsiP8CHCH7UU=
sha1:AZvN4hwdfcqd5xi8VH3UgXueY10=
 by: Andreas Eder - Sun, 20 Mar 2022 08:42 UTC

On So 20 Mär 2022 at 02:46, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

> On 19.03.2022 18:56, David W. Hodgins wrote:
>> On Sat, 19 Mar 2022 12:51:20 -0400, Janis Papanagnou
>> <janis_papanagnou@hotmail.com> wrote:
>>
>>> I just noticed that my fold command doesn't respect the locale settings.
>>>
>>> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
>>> [...]
>>> In a de_DE.UTF-8 locale the umlauts aren't handled properly, which makes
>>> it pretty useless. :-(
>>>
>>> Or is my fold version too old?
>>>
>>> $ fold --version
>>> fold (GNU coreutils) 8.13
>>
>> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
>> S
>> ä
>> g
>> e
>> $ fold --version
>> fold (GNU coreutils) 8.32
>> [...]
>
> Ah, fine, so that seems to have gotten fixed. Thanks!
>
> Janis

Hmm, here I have
$ fold --version
fold (GNU coreutils) 9.0
[...]

but
$ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
S �

g
e

'Andreas

Re: How do I escape a string that contains both single and double quotes?

<8735jcogi6.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5134&group=comp.unix.shell#5134

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Sun, 20 Mar 2022 14:17:21 +0000
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <8735jcogi6.fsf@bsb.me.uk>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me>
<op.1jahfniqa3w0dxdave@hodgins.homeip.net> <878rt5ntki.fsf@bsb.me.uk>
<t16c9r$rbb$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="676fdda65164f3a38beba70df3828b88";
logging-data="29947"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kvD5Ihr+yj6zUBNR7IeZI9H+uYadPnSY="
Cancel-Lock: sha1:sgaCBXmTFc2yEt4pBsRsd/tcjUE=
sha1:9oYzkgWDw+o96Y7EIWIGKJVPVEY=
X-BSB-Auth: 1.bca000d6b2d9de28032f.20220320141721GMT.8735jcogi6.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 20 Mar 2022 14:17 UTC

Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

> On 20.03.2022 05:20, Ben Bacarisse wrote:
>> "David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:
>>>
>>> $ echo Säge | LC_ALL=de_DE.UTF-8 fold -w 1
>>> S
>>> ä
>>> g
>>> e
>>
>> $ echo Säge | LC_ALL=en_GB.UTF-8 fold -w 1
>> S
>> �
>> �
>> g
>> e
>> $ echo Säge | LC_ALL=en_GB.UTF-8 wc -m
>> 5
>> $
>>
>> (That last one just to show that some utilities do get UTF-8 characters
>> right).
>
> My first thought was that lang:EN would not need to know an Umlaut
> character (so it would interpret the two-octet character as binary);
> i.e. a semantical interpretation, not a technical (encoding) one.
>
> Is the language the determining factor or the character set encoding?

No. The language part is used for other things, but the encoding should
be respected. en_GB does not mean I can't quote Gödel. Just to check:

$ echo Säge | LC_ALL=en_GB.ISO-8859.1 wc -m
6

--
Ben.

Re: How do I escape a string that contains both single and double quotes?

<op.1jca83fua3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5135&group=comp.unix.shell#5135

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sun, 20 Mar 2022 13:37:41 -0400
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <op.1jca83fua3w0dxdave@hodgins.homeip.net>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me> <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
<878rt5ntki.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="da88bd8d9e54d7d66d6e43bbb3bf65f6";
logging-data="20556"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2+5efDtJjqYB2ZC8lBsUJZY2LID0IhZA="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:5qELYOlweYP/PHs7cFgir68zmaA=
 by: David W. Hodgins - Sun, 20 Mar 2022 17:37 UTC

On Sun, 20 Mar 2022 00:20:29 -0400, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> Hmm... I have 8.32 but
>
> $ echo Säge | LC_ALL=en_GB.UTF-8 fold -w 1
> S
> �
> �
> g
> e
> $ echo Säge | LC_ALL=en_GB.UTF-8 wc -m
> 5
> $
>
> (That last one just to show that some utilities do get UTF-8 characters
> right).

I suspect it's due to a missing locale or (more likely) font package.

$ rpm -qa|grep locales|sort|wc -l
185
$ rpm -qa|grep font|sort|wc -l
391

$ echo Säge | LC_ALL=en_GB.UTF-8 fold -w 1
S ä
g e

$ du -s /usr/share/fonts/
3.0G /usr/share/fonts/

Regards, Dave Hodgins

Re: How do I escape a string that contains both single and double quotes?

<op.1jcbiqd2a3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5136&group=comp.unix.shell#5136

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sun, 20 Mar 2022 13:43:28 -0400
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <op.1jcbiqd2a3w0dxdave@hodgins.homeip.net>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me> <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
<878rt5ntki.fsf@bsb.me.uk> <op.1jca83fua3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="da88bd8d9e54d7d66d6e43bbb3bf65f6";
logging-data="27242"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wpNkUwzRJs7/htHyL0by6etSNTAO9tuc="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:i6qwpsjcQJb3IDEmW2iCS/Zxsx0=
 by: David W. Hodgins - Sun, 20 Mar 2022 17:43 UTC

On Sun, 20 Mar 2022 13:37:41 -0400, David W. Hodgins <dwhodgins@nomail.afraid.org> wrote:
> I suspect it's due to a missing locale or (more likely) font package.
> $ echo Säge | LC_ALL=en_GB.UTF-8 fold -w 1
> S
> ä
> g
> e

As it's bash in a terminal, is the terminus-font package installed?

Regards, Dave Hodgins

Re: How do I escape a string that contains both single and double quotes?

<877d8omkon.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5137&group=comp.unix.shell#5137

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Sun, 20 Mar 2022 20:30:00 +0000
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <877d8omkon.fsf@bsb.me.uk>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me>
<op.1jahfniqa3w0dxdave@hodgins.homeip.net> <878rt5ntki.fsf@bsb.me.uk>
<op.1jca83fua3w0dxdave@hodgins.homeip.net>
<op.1jcbiqd2a3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="676fdda65164f3a38beba70df3828b88";
logging-data="32645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/bnUKMiV4zNwqvVX4L8rgcG+mFWycWleA="
Cancel-Lock: sha1:6U/TZ/GMu+L9tClMq42/LtCFvWw=
sha1:HLzuKTJ3Y4RlDCB6+vN7QNAG7GA=
X-BSB-Auth: 1.61d845ff30cb7ffa26dd.20220320203000GMT.877d8omkon.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 20 Mar 2022 20:30 UTC

"David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

> On Sun, 20 Mar 2022 13:37:41 -0400, David W. Hodgins <dwhodgins@nomail.afraid.org> wrote:
>> I suspect it's due to a missing locale or (more likely) font package.
>> $ echo Säge | LC_ALL=en_GB.UTF-8 fold -w 1
>> S
>> ä
>> g
>> e
>
> As it's bash in a terminal, is the terminus-font package installed?

I don't see how it could be a font issue. The character displays fine,
and even if it did not, that should have no effect on whether fold
counts them correctly.

Looking at the source of fold in coreutils 8.32 I can't see any code
that could possibly count the UTF-8 encoding of ä as a single character.

Are you using a single-byte character encoding? (Setting
LC_ALL=en_GB.UTF-8 won't change that since fold appears to ignore the
encoding.) What does echo Säge | hd show?

--
Ben.

Re: How do I escape a string that contains both single and double quotes?

<op.1jcj0siva3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5138&group=comp.unix.shell#5138

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sun, 20 Mar 2022 16:47:06 -0400
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <op.1jcj0siva3w0dxdave@hodgins.homeip.net>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me> <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
<878rt5ntki.fsf@bsb.me.uk> <op.1jca83fua3w0dxdave@hodgins.homeip.net>
<op.1jcbiqd2a3w0dxdave@hodgins.homeip.net> <877d8omkon.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="da88bd8d9e54d7d66d6e43bbb3bf65f6";
logging-data="29050"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ymqDWh29Q5F71pfFJD3h5au2Kb3lEJvQ="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:N9JA4jKfUAg82BF2z+Da1FiWUeA=
 by: David W. Hodgins - Sun, 20 Mar 2022 20:47 UTC

On Sun, 20 Mar 2022 16:30:00 -0400, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> I don't see how it could be a font issue. The character displays fine,
> and even if it did not, that should have no effect on whether fold
> counts them correctly.
>
> Looking at the source of fold in coreutils 8.32 I can't see any code
> that could possibly count the UTF-8 encoding of ä as a single character.
>
> Are you using a single-byte character encoding? (Setting
> LC_ALL=en_GB.UTF-8 won't change that since fold appears to ignore the
> encoding.) What does echo Säge | hd show?

$ man echo
[dave@x3 ~]$ echo -n Säge|hexdump -x
0000000 c353 67a4 0065
0000005

Regards, Dave Hodgins

Re: How do I escape a string that contains both single and double quotes?

<871qywmiyl.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5139&group=comp.unix.shell#5139

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Sun, 20 Mar 2022 21:07:14 +0000
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <871qywmiyl.fsf@bsb.me.uk>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me>
<op.1jahfniqa3w0dxdave@hodgins.homeip.net> <878rt5ntki.fsf@bsb.me.uk>
<op.1jca83fua3w0dxdave@hodgins.homeip.net>
<op.1jcbiqd2a3w0dxdave@hodgins.homeip.net> <877d8omkon.fsf@bsb.me.uk>
<op.1jcj0siva3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="676fdda65164f3a38beba70df3828b88";
logging-data="32645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xATROKbYvQUY3abu6vFFHvDpFEYWiQFo="
Cancel-Lock: sha1:rsh4r+45wC9FSuAxYGjK1oUwllM=
sha1:S4iTNdIrn7b8lSevesJ19hz0ABg=
X-BSB-Auth: 1.a105701a4ebc0f33c4ad.20220320210714GMT.871qywmiyl.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 20 Mar 2022 21:07 UTC

"David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

> On Sun, 20 Mar 2022 16:30:00 -0400, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
>> I don't see how it could be a font issue. The character displays fine,
>> and even if it did not, that should have no effect on whether fold
>> counts them correctly.
>>
>> Looking at the source of fold in coreutils 8.32 I can't see any code
>> that could possibly count the UTF-8 encoding of ä as a single character.
>>
>> Are you using a single-byte character encoding? (Setting
>> LC_ALL=en_GB.UTF-8 won't change that since fold appears to ignore the
>> encoding.) What does echo Säge | hd show?
>
> $ man echo
> [dave@x3 ~]$ echo -n Säge|hexdump -x
> 0000000 c353 67a4 0065
> 0000005

Thanks for that. hexdump -c (or -b) makes UTF-8 a bit easier to read,
especially when there's an odd number of bytes but I can see what's
going on.

c3 a4 is indeed the UTF-8 encoding of ä, so I am at a loss to see how
the source code for fold that I saw could produce the correct output!
Maybe I missed something.

--
Ben.

Re: How do I escape a string that contains both single and double quotes?

<87v8w8l2yp.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5141&group=comp.unix.shell#5141

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Sun, 20 Mar 2022 21:38:06 +0000
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <87v8w8l2yp.fsf@bsb.me.uk>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me>
<op.1jahfniqa3w0dxdave@hodgins.homeip.net> <878rt5ntki.fsf@bsb.me.uk>
<op.1jca83fua3w0dxdave@hodgins.homeip.net>
<op.1jcbiqd2a3w0dxdave@hodgins.homeip.net> <877d8omkon.fsf@bsb.me.uk>
<op.1jcj0siva3w0dxdave@hodgins.homeip.net> <871qywmiyl.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="676fdda65164f3a38beba70df3828b88";
logging-data="11314"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eyJlYtD8TNwD/4uyWumjNUSgd4iFQk0I="
Cancel-Lock: sha1:LG13na4dW+gzSZ00b4YzY8UjUxQ=
sha1:uKbsXFIcVv3MRoSQ3BXDEaanFco=
X-BSB-Auth: 1.b10fddba5c299f476dea.20220320213806GMT.87v8w8l2yp.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 20 Mar 2022 21:38 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> "David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:
>
>> On Sun, 20 Mar 2022 16:30:00 -0400, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
>>> I don't see how it could be a font issue. The character displays fine,
>>> and even if it did not, that should have no effect on whether fold
>>> counts them correctly.
>>>
>>> Looking at the source of fold in coreutils 8.32 I can't see any code
>>> that could possibly count the UTF-8 encoding of ä as a single character.
>>>
>>> Are you using a single-byte character encoding? (Setting
>>> LC_ALL=en_GB.UTF-8 won't change that since fold appears to ignore the
>>> encoding.) What does echo Säge | hd show?
>>
>> $ man echo
>> [dave@x3 ~]$ echo -n Säge|hexdump -x
>> 0000000 c353 67a4 0065
>> 0000005
>
> Thanks for that. hexdump -c (or -b) makes UTF-8 a bit easier to read,
> especially when there's an odd number of bytes but I can see what's
> going on.
>
> c3 a4 is indeed the UTF-8 encoding of ä, so I am at a loss to see how
> the source code for fold that I saw could produce the correct output!
> Maybe I missed something.

I don't think I did miss anything but there is a bug report about this
that suggests that there is a fedora patch that fixes it. Your distro
probably has that patch applied. That would be the simplest
explanation.

--
Ben.

Re: How do I escape a string that contains both single and double quotes?

<op.1jcnq3exa3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5142&group=comp.unix.shell#5142

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Sun, 20 Mar 2022 18:07:41 -0400
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <op.1jcnq3exa3w0dxdave@hodgins.homeip.net>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t151m8$4ie$1@dont-email.me> <op.1jahfniqa3w0dxdave@hodgins.homeip.net>
<878rt5ntki.fsf@bsb.me.uk> <op.1jca83fua3w0dxdave@hodgins.homeip.net>
<op.1jcbiqd2a3w0dxdave@hodgins.homeip.net> <877d8omkon.fsf@bsb.me.uk>
<op.1jcj0siva3w0dxdave@hodgins.homeip.net> <871qywmiyl.fsf@bsb.me.uk>
<87v8w8l2yp.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="da88bd8d9e54d7d66d6e43bbb3bf65f6";
logging-data="17178"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dQnZ683LC3DgHPaITpzLqrMr2c/gg74k="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:j59hMC780/ClEnYmBqY7eQWSmq4=
 by: David W. Hodgins - Sun, 20 Mar 2022 22:07 UTC

On Sun, 20 Mar 2022 17:38:06 -0400, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> I don't think I did miss anything but there is a bug report about this
> that suggests that there is a fedora patch that fixes it. Your distro
> probably has that patch applied. That would be the simplest
> explanation.

Confirmed for Mageia.
https://svnweb.mageia.org/packages/updates/8/coreutils/current/SOURCES/coreutils-i18n.patch?revision=1679406&view=markup
is a patch to support multibyte characters, for the Mageia 8 version of the coreutils
package, which includes the fold command.

Regards, Dave Hodgins

Re: How do I escape a string that contains both single and double quotes?

<t19jc5$t30$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5144&group=comp.unix.shell#5144

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ottavio2...@yahoo.com (Ottavio Caruso)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Mon, 21 Mar 2022 10:17:41 +0000
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <t19jc5$t30$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me>
<slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid> <t11qkq$2go$1@dont-email.me>
<slrnt3buc5.1rfm.grahn+nntp@frailea.sa.invalid>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 21 Mar 2022 10:17:42 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b59094288f28a6b20e2ed6bba71e78aa";
logging-data="29792"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/w+VLQdW1UmYmD2j2dj88UZUG3+OxuiMg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.0.3
Cancel-Lock: sha1:rC8R1/3MPnDdMMoIfdesQplnmSg=
X-No-Archive: yes
In-Reply-To: <slrnt3buc5.1rfm.grahn+nntp@frailea.sa.invalid>
Content-Language: en-GB
 by: Ottavio Caruso - Mon, 21 Mar 2022 10:17 UTC

On 19/03/2022 15:40, Jorgen Grahn wrote:
> On Fri, 2022-03-18, Ottavio Caruso wrote:
>> On 18/03/2022 08:28, Jorgen Grahn wrote:
>>> If your cw-sort function read from stdin instead, could you still fit
>>> it into your workflow? I'm assuming you're normally calling it from
>>> some larger script.
>>
>> No, I call it from the shell.
>>
>> This is supposed to check the frequency of mistakes I make while
>> learning Morse code on lcwo.net.
>
> So, do you then paste the input from some web page? In that case I'd
> personally prefer:
>
> % cw-sort
> *paste*
> <EOF>
>
> to
>
> % cw-sort *paste*
>
> followed by manual escaping and quoting.
>
> But oh, maybe that's what you were asking for: a simple one-size-
> fits-all way you can do that without thinking. I have always assumed
> there is no such thing, so I didn't even read the responses which went
> into quoting.
>
> If there was such a thing, I would consider using it.
>
> /Jorgen
>

No, I don't paste. I have to manually spot the errors and input them in
the function.

Incidentally, I'm [pathetically and not knowing what I'm doing] working
on an offline version of LCWO, provisionally called "LCWOff". Github
clone will be ready somewhere in the future.

--
Ottavio Caruso

Pages:12
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor