-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UTF-8 encoding on MS-Windows #3292
Comments
Heh: // io_fwrite
public long fwrite(ThreadContext context, IRubyObject str, boolean nosync) {
// TODO: Windows
// #ifdef _WIN32
// if (fptr->mode & FMODE_TTY) {
// long len = rb_w32_write_console(str, fptr->fd);
// if (len > 0) return len;
// }
// #endif
str = doWriteconv(context, str);
ByteList strByteList = ((RubyString)str).getByteList();
return binwrite(context, str, strByteList.unsafeBytes(), strByteList.begin(), strByteList.length(), nosync);
} I will DO the TODO now :-) |
FWIW, most of the divergence between native and non-native is wrapped up inside PosixShim, which has native and non-native paths. That lives at the level of a C library "write" call, for example. The rest of the ported MRI code I tried to keep as close to MRI as possible and abstract those native/non paths elsewhere. Fix coming. I don't have Windows handy to test, but perhaps we poke the nightly build and give @carlosmrce a build to confirm with, ok? |
If anyone has an idea of how to test this, I'd love to hear it :-\ Edit: for example, running as a subprocess would not be a tty, so that doesn't work. Seems like we need a way to read back what was written to the console. |
I will be more than happy to test this out @headius |
Note for future: |
Note for a happier future: we should just go full native on this and hook into any neccesary transcoding. I fixed this originally with System.console() because it was super easy and works mostly. A second note is that I think our sub-process spawning is done wrong in jnr-posix and if it was done properly System.console() would not be null. The second note would make many more cases work and the former will work in cases where our default_internal is not a Java Charset. |
Hi there,
I posted an issue a while back, but it seems to be back!!!
Original issue: #1198
Just tested on MS-Windows and Linux, and the bug still exists.
Thanks!
The text was updated successfully, but these errors were encountered: