Hi Antonio, FYI, the Microsoft NTFS filesystem only stores files names in UTF-16LE (BMP). It does not store it as anything else. All other code pages are seamlessly and transparently translated back and forth by Windows on-the-fly. This is true even for the UTF-8 code page that Windows (partially) supports.
Regards, Andrew On 2018-09-10 at 12:58 PM, Antonio Scuri <antonio.sc...@gmail.com> wrote: Ok. That's important. The file system stores the names in some encoding, which can be Unicode for instance. But when the Lua interpreter receives that string some conversion is required, since the string is necessary a "char*" in main (remember that Lua is implemented in C). The converted string is then passed to the fopen function inside IM and everything works fine. But if you write the same string inside a Lua script, that conversion does not occurs. It will depend on how the text is encoded in the script. The difference between the encoded string in the script and the converted string received in the command line is the key issue here. So which encode we should use in the Lua script so it will work too? Before we answer that I would like you to do another test please, with the same file: require"iuplua" require"iupluaim" local filename = iup.GetFile("*.*") print (filename) ih = iup.LoadImage(filename) if (not ih) then print "Failed" else print "OK" end I attached the script also. Thanks, Scuri Em seg, 10 de set de 2018 às 14:02, 云履 <robert...@qq.com> escreveu: Test works fine in cmd.exe with my path and file name. And I'm confused how to use these path and file name in code, such as embed Filepath to loadimage in Lua. Thanks Sorry, that was a typo. We can continue here. Once we solved I will post it there. Sometimes is less noise. The idea was to test using "arg" in the Lua interpreter. For instance: D:\tecgraf\iup\bin\Win32\Lua53>lua53 d:\Downloads\loadimage.lua d:\downloads\blacksad1.jpg d:\downloads\blacksad1.jpg OK Best, Scuri Em seg, 10 de set de 2018 às 11:47, 云履 <robert...@qq.com> escreveu: Sorry, I don't quite get it. 1. I change 'require"iupim"' to 'require"iupluaim"', otherwise I'd get "error loading module 'iupim' from file" .. "Can't find specify program". 2. After change it, code could be ran. 3. I didn't change or update anything other than iup-3.25. Should I ? Problem still exist when 'file name and path contain multi-bytes characters', get "Failed" from print. And change a path and file would get "OK" as expected. BTW, I send this mail directly to your gmail, should I send it to iup-user mail list? require"iup" require"iupim" print [[....]] ih = iup.LoadImage[[....]] if (not ih) then print "Failed" else print "OK" end _______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users