|
From: Juergen W. <wie...@fr...> - 2005-11-14 09:00:56
|
Am Montag, 14. November 2005 09:45 schrieb Hans-Bernhard Broeker: > Ethan A Merritt wrote: > > It *would* be ended by the trailing single quote, if there were one. > > But there is no such trailing single quote in your command line > > because the only candidate has been escaped by a backslash. > > No, it's not supposed to be escaped. At least not in any version up to > 4.0 it wasn't. There are no backslash escapes being processed on > single-quoted strings in gnuplot, period. See 'help syntax'. Thus this > behaviour: "help syntax quotes" only says that there is no backslash processing of special characters. It does not state there is no special meaning of backslashes at all. At least, I cannot find it. > > gnuplot> set title 'C:\'; foo' ; show title > > title is "C:\\'; foo", offset at ((character units) 0, 0, 0) > > Is a bug, and has been as long as it was present in the program. > > > The backslash character is always interpreted as an escape during input. > > Not inside single-quoted strings. > > > Single or double quotes make no difference. > > If so, that's a bug, or an incompatible change since version 4.0. Proof > from 4.0 on Win32: > > gnuplot> set label 1 "a\n\t\\\qb" > gnuplot> set label 2 'a\n\t\\\qb' > gnuplot> show lab > > label 1 "a\n\t\\qb" at (0, 0, 0) left not rotated back nopoint > label 2 "a\\n\\t\\\\\\qb" at (0, 0, 0) left not rotated back nopoint > > gnuplot> > > In other words: \-escape sequences in "" can become special characters > like LF, TAB or the backslash itself, whereas \ characters in '' become > literal \ characters, which 'show' doubles up since it uses "" strings. The behaviour you show is exactly the same as raw strings in python. [With the exception that gnuplot silently terminates strings at the end of the line.] Really. Backslashes are used as escape characters and nevertheless taken into the string. It's insane. But strictly speaking, it's not a bug. And it has not changed since 3.7, AFAICS. Juergen |