Is path really consisting of UTF-16 bytes here? What you do here looks to be having some issues:
__dir__ might have the wrong encoding due to a Ruby bug. I’d fix that separately. The string should be UTF-8, but with incorrect encoding label. This is why I do this in my extensions:
What is the encoding of the file where you have "áéűúőóüöí/SUEX_HelloWorld.txt"? If you have the file saved as UTF-8 and then force the encoding UTF-16 then the bytes will be all wrong.
What I’d do is:
dir = __dir__
# Account for Ruby encoding bug under Windows.
dir.force_encoding('UTF-8') if file.respond_to?(:force_encoding)
# Now `dir` should be correctly labeled UTF-8 string.
path = File.join(dir, "áéűúőóüöí/SUEX_HelloWorld.txt")
# Assuming you saved the file as UTF-8, you should now have a well-formed UTF-8 string.
# Not sure what encoding Fiddle.dlopen accepts, but if you need UTF-16 you need to convert
# the encoding, not forcing it.
path_utf16 = path.encode("UTF-16LE")