Previous: standard conforming strings, Up: Strings [Contents][Index]
Guile 1.8 and later represent certain octets in the xrep, or
external representation, of a string with \xXX
, e.g.,
\x07
for #\bel
.
PostgreSQL 7.4 and 8.0 do not recognize \xXX
as valid syntax
in a literal string, which is a problem if you need to connect to
them.
But even for PostgreSQL 8.1 and later, which accepts \xXX
as
an octet with hex value XX
, a problem arises when there is a
mix of contiguous raw and \x
representations, intended to
represent (for instance) a UTF-8 encoded character.
It seems1
Guile
- 1.4 DTRT by doing nothing (mu power!);
- 1.6 likewise is blissfully unperturbing;
- 1.8 fails by \x
-escaping inconsistently;
- 2.0 doesn’t have this problem.
To avoid both problems, use string-xrep
.
Return the external representation of string,
guaranteed to not have \x
-escape sequences.
Specifically, the first and last characters are double-quote #\"
,
and internal #\\
and #\"
are backslash-escaped.
Characters that normally have an xrep with \x
are instead
passed straight through. For some Guile versions, this behavior
is identical to object->string
.
The survey and its results are in the ‘guile-user’ archive:
http://lists.gnu.org/archive/html/guile-user/2012-01/msg00114.html.