If you are working in a UTF-8 locale (as on most Unix-like systems), you
should be fine. If not (as is normal on Windows), you'll need to
translate the string to the local encoding. The Writing R Extensions
manual section 6.11 tells you how to do the re-encoding.
Re: How to print UTF-8 encoded strings from a C routine to R's output?
Thanks a lot for your quick reply pointing out the Re-encoding section that
Before trying out R's C-level interface to the iconv's encoding conversion
I did some quick tests with Encoding() and iconv() on Windows with Rgui and
After Encoding(), non-ASCII characters are fine with Rgui but still wrong
After iconv(), non-ASCII characters are still misprinted no matter if it is
Rgui or Rterm.
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 14393)
 LC_COLLATE=English_United States.1252
 LC_CTYPE=English_United States.1252
 LC_MONETARY=English_United States.1252
 LC_TIME=English_United States.1252
attached base packages:
 stats graphics grDevices utils datasets methods base
Am I missing something obvious? Thanks a lot for your help and your time!
On Mon, Sep 5, 2016 at 3:31 AM, Duncan Murdoch <[hidden email]>
> On 05/09/2016 12:40 AM, Lixin Gong wrote:
>> Dear R experts,
>> It seems that Rprintf has to be used to print from a C routine to
>> to write to R’s output according to
>> However if a string is UTF-8 encoded, non-ASCII characters (e.g., the
>> infinity symbol http://www.fileformat.info/inf >> o/unicode/char/221e/index.htm)
>> are misprinted.
>> Is this an unsupported feature or is there a workaround for this
> If you are working in a UTF-8 locale (as on most Unix-like systems), you
> should be fine. If not (as is normal on Windows), you'll need to translate
> the string to the local encoding. The Writing R Extensions manual section
> 6.11 tells you how to do the re-encoding.
> Duncan Murdoch