[plt-scheme] mzchar and wchar_t

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Mar 16 12:41:15 EST 2006

At Wed, 15 Mar 2006 19:00:39 +0100, Jean-Guillaume wrote:
> 
> Le 15 mars 06 à 14:13, Matthew Flatt a écrit :
> > At Tue, 14 Mar 2006 15:55:54 -0800, "Jim Blandy" wrote:
> >> On 3/14/06, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> >>> At Tue, 14 Mar 2006 12:36:05 +0100, Jean-Guillaume wrote:
> >>>> Is there a simple relation between mzchar and wchar_t (and wint_t)
> >>>> types ?
> >>>
> >>> If you have a wchar_t whose value that is in [0, #xD7FF] or [#xE000,
> >>> #xFFFF], then you can use it as a mzchar and vice-versa.
> >>>
> >>> [...]
> 
> Thanks, 

Well, keep in mind that the above was wrong. My retraction is here:

 http://list.cs.brown.edu/pipermail/plt-scheme/2006-March/012186.html


If you don't need portability, then the problem is simpler. For
example, I think glibc's wchar_t and MzScheme's mzchar are the same
(but I'm not positive), Window's wchar_t is a UTF-16 code unit
(definitely), and so on.

> But do you mean it can be unsafe for  
> some unicode values ? Maybe it works incidentaly because I set my  
> locale to utf-8 ?

Taking a wild guess, I'll be it always works in your test because
you're using glibc. Or you're using Windows and not using any
characters whose value is above #xFFFF. On an arbitrary platform,
though, it could work arbitrarily badly.

Matthew



Posted on the users mailing list.