Print() CPP does not use UTF8
Monkey Forums/Monkey Bug Reports/Print() CPP does not use UTF8
| ||
| The Print() function in CPP desktop targets do not use the UTF8. using this code in Monkey/modules/monkey/native/lang.cpp seems to fix it. I have not tested in all circumstances.
int Print( String t ){
std::vector<char> buf;
const Char *p = t.Data();
int n=t.Length();
int i=0;
while ( i<n) {
Char c = *p;
if( c<0x80){
buf.push_back( c );
}else if( c<0x800 ){
buf.push_back( 0xc0 | (c>>6) );
buf.push_back( 0x80 | (c & 0x3f) );
}else {
buf.push_back( 0xe0 | (c>>12) );
buf.push_back( 0x80 | ((c>>6) & 0x3f) );
buf.push_back( 0x80 | (c & 0x3f) );
}
p++;
i++;
}
buf.push_back(0);
puts( &buf[0] );
fflush( stdout );
return 0;
}EDIT: a duplicate of http://monkeycoder.co.nz/Community/posts.php?topic=4439 |