[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}
From: |
Andy Wingo |
Subject: |
Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword} |
Date: |
Mon, 06 Sep 2010 18:58:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Greetings,
On Mon 06 Sep 2010 18:28, Mike Gran <address@hidden> 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/
- need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Andy Wingo, 2010/09/06
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Mike Gran, 2010/09/06
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword},
Andy Wingo <=
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Ludovic Courtès, 2010/09/06
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Mike Gran, 2010/09/07
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Ludovic Courtès, 2010/09/07
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Andy Wingo, 2010/09/07
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Ludovic Courtès, 2010/09/08
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Mike Gran, 2010/09/07
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Ludovic Courtès, 2010/09/08
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Andy Wingo, 2010/09/08
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Ludovic Courtès, 2010/09/08
- Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}, Andy Wingo, 2010/09/08
- Prev by Date:
Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}
- Next by Date:
Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}
- Previous by thread:
Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}
- Next by thread:
Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword}
- Index(es):