unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Richard Shann <richard@rshann.plus.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-user@gnu.org
Subject: Re: UTF8 string storage and retrieval in XML
Date: Mon, 01 Feb 2016 18:22:36 +0000	[thread overview]
Message-ID: <1454350956.1344.80.camel@rshann.plus.com> (raw)
In-Reply-To: <87fuxci9dl.fsf@netris.org>

On Mon, 2016-02-01 at 13:16 -0500, Mark H Weaver wrote:
> Richard Shann <richard@rshann.plus.com> writes:
> 
> > Can anyone explain what is going on when you try to store strings with
> > non-ASCII characters? Here is an example:
> >
> > guile> (define another-data "Čć")           
> > guile> another-data
> > "�\x8c�\x87"
> > guile> (display another-data)
> > Čćguile> 
> 
> I guess this is Guile 1.x, where strings are merely byte sequences.
> Your terminal is using the UTF-8 encoding, where "Čć" is represented as
> the byte sequence:
> 
>   0xC4 0x8C 0xC4 0x87
> 
> When printing this using 'write' (which is how values are printed at the
> REPL), Guile 1.x is treating this byte sequence as Latin-1.  The 0xC4 is
> the Latin-1 representation for the character "Ä", but 0x8C and 0x87 are
> not characters in Latin-1 and so are escaped as "\x8c" and "\x87".
> 
> When printing using display, Guile is simply writing the bytes out
> unescaped, which your terminal interprets as UTF-8.
> 
> Obviously this is terrible, which is why Guile 2.0+ strings are
> sequences of unicode code points.  Can you switch to Guile 2.0?

Thank you for the detailed explanation. I'm currently asking whether we
can switch, the problem will be that LilyPond is stuck at 1.8 because of
very complex issues I gather, and Denemo runs LilyPond to typeset the
music entered.
Is there any reasonable workaround - can I insert something to transform
the string?

Richard




      reply	other threads:[~2016-02-01 18:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 15:05 UTF8 string storage and retrieval in XML Richard Shann
2016-02-01 15:36 ` Richard Shann
2016-02-01 15:43   ` Thompson, David
2016-02-01 16:58     ` Richard Shann
2016-02-01 18:16 ` Mark H Weaver
2016-02-01 18:22   ` Richard Shann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454350956.1344.80.camel@rshann.plus.com \
    --to=richard@rshann.plus.com \
    --cc=guile-user@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).