unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mike Gran <spk121@yahoo.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}
Date: Mon, 06 Sep 2010 18:58:04 +0200	[thread overview]
Message-ID: <m37hiykdwj.fsf@unquote.localdomain> (raw)
In-Reply-To: <998452.84210.qm@web37903.mail.mud.yahoo.com> (Mike Gran's message of "Mon, 6 Sep 2010 09:28:03 -0700 (PDT)")

Greetings,

On Mon 06 Sep 2010 18:28, Mike Gran <spk121@yahoo.com> writes:

> there is a failure case to consider for scm_from_utf8_string.  The C
> utf8 string could contain incorrectly encoded data.

There is the analogous case of scm_to_locale_string, if the string is not
encodable in the current locale.

> You could throw the encoding error, or you could replace the 
> bad utf8 with U+FFFD or the question mark.
>
> The bytevector's utf8->string always throws encoding-error.
> Maybe that's good enough.

Yeah, maybe so.

> Otherwise, perhaps something like
>
> scm_from_utf8_stringn (str, len, error_or_replace_strategy)
>
> If you didn't mind the overhead of calling the somewhat 
> heavyweight scm_{to,from}_stringn, these could be macros
> or inline functions that wrap that.

Ah, I did not see scm_{to,from}_stringn. Cool! I think
scm_from_utf8_stringn et al should be proper functions, and probably
their initial implementations just call scm_{to,from}_stringn. But we
should at least do the straightforward optimization for the latin1 case.

Cheers,

Andy
-- 
http://wingolog.org/



  reply	other threads:[~2010-09-06 16:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-06 11:23 need: scm_from_{utf8,latin1}_{string,symbol,keyword} Andy Wingo
2010-09-06 16:28 ` Mike Gran
2010-09-06 16:58   ` Andy Wingo [this message]
2010-09-06 17:02 ` Ludovic Courtès
2010-09-07 15:21   ` Mike Gran
2010-09-07 17:11     ` Ludovic Courtès
2010-09-07 22:05       ` Andy Wingo
2010-09-08 12:35         ` Ludovic Courtès
2010-09-08  3:26       ` Mike Gran
2010-09-08 12:11         ` Ludovic Courtès
2010-09-08 19:33           ` Andy Wingo
2010-09-08 21:04             ` Ludovic Courtès
2010-09-08 19:20         ` Andy Wingo

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=m37hiykdwj.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=spk121@yahoo.com \
    /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).