minetest / irrlicht

Minetest's fork of Irrlicht
Other
114 stars 87 forks source link

Fix character encoding conversion issues #249

Closed grorp closed 11 months ago

grorp commented 12 months ago

Continuation of #221. Fixes #216 and fixes minetest/minetest#13646.

The Irrlicht string conversion functions are not broken, they are just the wrong kind of conversion functions: Irrlicht uses wide <-> multibyte conversion functions in places where it should actually use wide <-> UTF-8 conversion functions. This usually works because the locale-defined multibyte encoding is UTF-8 in many environments, but sometimes, it doesn't.

This PR introduces new wide <-> UTF-8 conversion functions, utf8ToWString and wStringToUTF8, and uses them where appropriate. wStringToMultibyte is not used anymore and has been removed, multibyteToWString has been kept because it is still used in one place.

EDIT: btw, "AutomatedTest" doesn't even compile on Windows.

To do

This PR is Ready for Review. Before merging, 69622fe641017a10eaf05d0f36186fea424d80ec should be reverted.

How to test

Compile Minetest on Windows with and without SDL. Set a weird combination of language settings. Verify that Unicode text is displayed/copied/whatever-ed correctly.

sfan5 commented 11 months ago

Merged.

EDIT by grorp: as commits 93eebed and c766c3a

grorp commented 11 months ago

Thanks!