[R-SIG-Mac] Question on warnings like "wchar_t is Unicode on this platform"

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jul 19 18:44:00 CEST 2012

On 19/07/2012 17:14, Hans-Jörg Bibiko wrote:
> Hi,
> [Since I have not a Windows machine at hand - I cannot say if it's a general R issue.]

It's nothing to do with Windows, and everything to do with Apple's 
contempt for standards conformance (which these days vies with Microsoft's).

> I'm dealing with some texts written in languages which are using e.g. this character:
> An naïve example:
> print("Ɂ")
> and I get:
> [1] "\u0241"
> Warning message:
> In print.default("\u0241") :
>    it is not known that wchar_t is Unicode on this platform
> utf8ToInt("Ɂ") will be processed correctly.
> If I do something like:
> print(intToUtf8(32:5000))
> I see lots of \u....

That's a different issue. Quite a lot of those are not printable Unicode 
points (some are not even valid ones).

> Ok, I could use "cat()" to print such characters but ...
> As far as I can see in e.g. "printutils.c" the decision is made due to the returned value of "iswprint()". "iswprint()" depends on locale's setting and I set locale to en_US.UTF-8.
> Would it be possible to "update" the code to be able to print normal Unicode characters?
> This issue also arises if I try to name e.g. rows and/or columns of R-objects.

You need to correct the information given by the OS.  If it doesn't know 
if its wide characters are Unicode, there is no portable way in C99 to 
convert Unicode points to glyphs.

Define __STDC_ISO_10646__ if you know better than your OS headers.

Unicode does publish tables to determine if Unicode points are 
printable.  Does Apple use them?  Given how much of its OS is based on 
pre-internationalized FreeBSD, I doubt it.  (I am talking here about ISO 
C99 functions, not Apple's own API.)

> Kind regards,
> --Hans
> --------
> Mac OS 10.7.4
> R version 2.14.2 (2012-02-29)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> loaded via a namespace (and not attached):
> [1] tools_2.14.2
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-SIG-Mac mailing list