On Thu, 16 Nov 2017 09:53:46 -0800, [email protected] wrote:
> On 2017.07 on Win7 with 65001 code page enabled, the » char doesn't
> show up at all. Just seems to get removed from the content if I paste
> it into the terminal.
Starting to think this might be a limitation of cmd.exe. Though strangely,
I'm failing to find anyone mentioning this problem on Google...
For example, Perl 5 has the exact same problem that the fancy chars get
stripped:
C:\rakudo>perl -wlE "say '[' . scalar(readline) . ']'"
e »♥ b
[e b
]
I also cobbled together this C program from MSDN's code examples and the same
problem is present in it as well:
#include <fcntl.h>
#include <io.h>
#include <stdlib.h>
#include <stdio.h>
#include <share.h>
int main( void ) {
int fh, i;
unsigned char buffer[60000];
unsigned int nbytes = 60000, bytesread;
int result;
result = _setmode(_fileno(stdin), _O_BINARY);
if( result == -1 )
perror( "Cannot set mode" );
else
printf( "'stdin' successfully changed to binary mode\n" );
if( ( bytesread = _read( _fileno( stdin ), buffer, nbytes ) ) <= 0 )
perror( "Problem reading file" );
else
printf( "Read %u bytes from file\n", bytesread );
printf("Read this: `");
for (i = 0; i < bytesread; i++)
printf("%u ", buffer[i]);
printf("`\n================\n");
return 1;
}
Anything fancy gets read as a nul byte instead of the proper bytes for that
char:
C:\rakudo>gcc test.c && a.exe
'stdin' successfully changed to binary mode
e »♥ b
Read 8 bytes from file
Read this: `101 32 0 0 32 98 13 10 `
================
C:\rakudo>