Could you clarify a few things?
it's also fine on the Windows system if the output filehandle is to a file, or if I redirect the output to a file (rather than allowing it to go to the cmd.exe console)
In both of those cases, what encoding is the resulting file in? (see for example my tool enctool)
use utf8; ... unsigned char a = '±';
That looks wrong to me because a char is one byte and you've given it two (C2 B1), so I don't know if your C example is representative, and gcc does complain warning: multi-character character constant [-Wmultichar].
In pure Perl, with a combination of chcp 65001 and use open qw/:std :encoding(UTF-8)/;, I can get it to output correctly, but I guess the question is what encoding the library is using (hence my question above).
C:\Temp>type test.pl
#!perl
use warnings;
use strict;
use open qw/:std :encoding(UTF-8)/;
print "\N{U+B1}\N{U+221E}\n";
C:\Temp>chcp
Active Codepage: 850.
C:\Temp>perl test.pl
┬▒Ôê×
C:\Temp>chcp 65001
Active Codepage: 65001.
C:\Temp>perl test.pl
±∞
In reply to Re: Encoding problem with function in C library
by haukex
in thread Encoding problem with function in C library
by syphilis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |