[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNUlib unicode encoding causes smart quotes to be displayed in progr

From: Paul Eggert
Subject: Re: GNUlib unicode encoding causes smart quotes to be displayed in program's output
Date: Fri, 6 Dec 2019 19:16:13 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

On 12/6/19 6:52 PM, Wes Hurd wrote:
What I meant about smart quotes being dangerous was, if copying the output text that contains smart quotes to use somewhere else (especially in code), the smart quotes have to be manually replaced which is tedious for the user (programmer). The user may not even see that smart quotes are being used unless there is a breaking error.

That sort of problem can occur with any quoting style. For example:

$ cp '\0' 'xxx'
cp: cannot stat '\0': No such file or directory

If I cut the '\0' (including the apostrophes) and then paste it into a C program, like this:

char *filename = '\0';

the program will compile (it's valid C code!), but it won't do what I want. If I paste '\0' into a Python program, I'll get a different string (it's a valid Python string too) but it won't equal the filename I gave to 'cp'.

Arguably curved quotes would be *safer* than apostrophes here, because they would require the programmer to think about quoting when the programmer is doing something silly like copying quoted strings blindly into a program.

Admittedly this example is contrived, but there's lots of non-contrived examples like it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]