() Thien-Thi Nguyen <[email protected]>
() Fri, 27 Jan 2012 11:27:30 +0100

   The code assumes Guile 2 DTRT [...]

Well, further investigation raises new doubts.  The issue really
is in contiguous mixed raw and \x-escaped octets, and not just
single byte external representation, so here is a followup
experiment that addresses that directly:

(setlocale LC_ALL "")

(define (hmm symbol)
  (define (show x)
    (display x) (display "\t") (write x) (newline))
  (newline)
  (show symbol)
  (let ((string (symbol->string symbol)))
    (show string)
    (show (object->string string))))

(display "LANG: ") (write (getenv "LANG")) (newline)
(hmm 'foo)
(hmm '#{f\"o b\\r}#)
(hmm '⌬)                                ; U+232C (utf-8: E2 8C AC)
(hmm '䕫)                               ; U+2F9B2 (utf-8: F0 AF A6 B2)
(hmm '蜨)                               ; U+2F9BC (utf-8: F0 AF A6 BC)
Below are the output of two runs:

  guile -s xrep2.scm \
    | tee xrep2-$(guile --version | sed 's/.* //;q')-$LANG.out

What do other people see?

LANG: "it_IT.UTF-8"

foo     foo
foo     "foo"
"foo"   "\"foo\""

#{f\"o\ b\\r}#  #{f\"o\ b\\r}#
f"o b\r "f\"o b\\r"
"f\"o b\\r"     "\"f\\\"o b\\\\r\""

⌬       ⌬
⌬       "⌬"
"⌬"     "\"⌬\""

䕫       䕫
䕫       "䕫"
"䕫"     "\"䕫\""

蜨       蜨
蜨       "蜨"
"蜨"     "\"蜨\""
LANG: "it_IT.UTF-8"

foo     foo
foo     "foo"
"foo"   "\"foo\""

#{\f\\\"o\ b\\\\r}#     #{\f\\\"o\ b\\\\r}#
f\"o b\\r       "f\\\"o b\\\\r"
"f\\\"o b\\\\r" "\"f\\\\\\\"o b\\\\\\\\r\""

âЌ     âЌ
âЌ     "â\x8c¬"
"â\x8c¬"        "\"â\\x8c¬\""

䕫    䕫
䕫    "䕫"
"䕫"  "\"䕫\""

蜨    蜨
蜨    "蜨"
"蜨"  "\"蜨\""

Reply via email to