> And some conversion should be done manually if filepath is embedded in
code?

  Yes, it should. We have to figure out which one. But we are getting
closer.

   Now use the following code to generate a text file "test.txt". Its
contents will be the filename string. You can get the string from the
command line or from IupGetFile:

----------------------------------------------------------------
require"iuplua"

function write_file(filename, str)
  local ifile = io.open(filename, "w")
  if (not ifile) then
    iup.Message("Error", "Can't open file: " .. filename)
    return
  end

  if (not ifile:write(str)) then
    iup.Message("Error", "Fail when writing to file: " .. filename)
  end

  ifile:close()
end

--local filename = iup.GetFile("*.*")
local filename = arg[1]

print (filename)
write_file("test.txt", "filename = " .. filename)
----------------------------------------------------------------

  I use a free text edit that helps a lot with string problems. It is
called Notepad++:

https://notepad-plus-plus.org/

  Try to open the "test.txt" file and see if the internal string gets
displayed correctly. In the menu Encoding you will be able to identify
which encoding it is using, and if necessary to change it.

  Notice that this is different that the bottom items of the same menu,
where several "Convert to" items are available. This is not what we what.
We want to simply display the text that it is already using the encoding we
want, with the correct visualization.

Best,
Scuri


Em seg, 10 de set de 2018 23:16, 云履 <[email protected]> escreveu:

> Hi,
>
> I test and get "OK" from editor (ZeroBrane Studio) and from CMD.
> The filename printed is correct, too.
> In CMD, I try to just assign my filename directly in code. It will get
> mess string printed in CMD, and "Failed".
> In editor, print string is always correct.
>
> Now I understand your opinion, it is encode stuff.
> And some conversion should be done manually if filepath is embedded in
> code?
> I tried some, and failed..
> _______________________________________________
> Iup-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to