[plt-scheme] v299 unicode -> (char *)

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Oct 25 18:31:32 EDT 2004

On Oct 25, Ron Stanonik wrote:
> [...] SCHEME_BYTE_STR_VAL might do it, but then I would need to
> convert from chars to bytes in scheme (I guess) before calling the
> extension?

That's the sane approach, at least IMO.  Dealing with different
encodings can be complicated, so it's better to do it in Scheme, where
it's also easy to hide the extra step by wrapping your functions with
code that will do the conversion.  The foreign interface does just
that -- at the C level there is only byte strings, and mzscheme's
UCF-4 strings, then the Scheme part provides a `_string' type that
will choose some string->bytes/... conversion.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.