-
Notifications
You must be signed in to change notification settings - Fork 87
Fix UTF-8 / wide string conversion functions #221
Conversation
Given that Irrlicht is to be merged eventually I think it's more worthwhile to adjust Irrlicht to fit Minetest and not the other way around.
definitely |
Yes, you're right, but how?
OK :) |
Not sure if that works but maybe we can get away with referencing the MT functions as |
This works when building MT, but breaks the unit tests... Would putting a stub into the unit tests suffice? EDIT: No, that doesn't suffice. Actually, MT only seems to compile on Linux. On other platforms, it doesn't even compile... Doing it this way doesn't seem to be possible. |
I guess we have to copy-paste them over then. I'd prefer if this happened in a way that adds the fewest amount of code feasible. |
Different idea: maybe we can use |
64b45b6
to
32e0e26
Compare
All builds work fine, except the no-SDL MSVC builds. They fail with a completely unrelated error message:
I can reproduce this locally, but I have no idea what's going on. |
The fun thing is that
I've now simply replaced |
My unit test (grorp/minetest#3) still fails on Windows and passes on Linux. On windows, keyboard input and window title have no problems with UTF-8 anymore, but copy-paste is completely broken (only tested with SDL, not without). Everything still works on Linux. |
I'm closing this pull request as I can't currently get it to work. I will reopen it if I can get it to work. Btw, I think the problem isn't that some of the conversion functions are broken, but that the Irrlicht functions work with the "locale-defined multibyte encoding" and the Minetest functions always work with UTF-8. We mix and match them in our code, especially at Minetest <-> Irrlicht boundaries. |
I've removed any use multibyte (as opposed to UTF-8) from Minetest years ago: minetest/minetest@c834d2ab2
Hmm, why isn't the following test impacted? https://github.com/minetest/irrlicht/blob/master/examples/AutomatedTest/test_string.cpp#L169
We should be using |
I meant that we mix and match the Minetest and Irrlicht conversion functions. For example:
The SDL version of However, the multibyte-encoded (as opposed to UTF-8) string is now passed to
irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp Lines 927 to 933 in 0735220
Obviously, this can't work. The "locale-defined multibyte encoding" seems to be
But I'm doing a lot of guesswork here. |
Ah, you're correct then.
Indeed, Windows still defaults to Latin-1 or other funny encodings depending on region. |
I now have a working version of this, it's just waiting for #246 to be fixed: grorp/irrlicht@058bddb...fixnofix |
@grorp would that fix minetest/minetest#13646 ? |
yes |
Fixes #216. Depends on minetest/minetest#13650.
The UTF-8 / wide string conversion functions in IrrlichtMt are broken on Windows (at least on my machine). Fortunately, Minetest has working ones. This PR moves the working UTF-8 / wide string conversion functions from Minetest to IrrlichtMt so that they can be used by both Minetest and IrrlichtMt. The broken ones have been removed.
I'd be interested in better ideas on how to fix this.
To do
This PR is a Work in Progress.
iconv
dependency from Minetest to IrrlichtMtHow to test
Verify that special characters are shown correctly in all contexts and on all platforms, I guess...
+ Verify that #216 is fixed.