Hi 云履,

  In IUP, CD and IM we use fopen to read and write files most of the time,
with a few exceptions when there is a native API that loads or saves the
file for us.

  IUP access files mainly for configuration files in LED, Lua or cfg
(IupConfig).

  CD writes metafiles, for instance.

  IM loads and saves image files in several different formats using
different APIs, but most of the time uses fopen too.

  So, actually they all have the same problem.

  We don't process the filename string before passing to fopen. If you can
use fopen yourself then you can use it through those libraries too. What I
mean is, if you can do something simple like:

int main(int argc, const char **argv)
{
   FILE *f = fopen(argv[1], "rb");
   if (f)
   {
     printf("OK\n");
     fclose(f);
  }
  else
     printf("Failed\n");

  return 0;
}

  And successful open your file, then IUP, CD and IM will also work,
regardless how the filename string is encoded.

  I still didn't have time to make a few tests since Andrew reported it.
Can you please test this simple code on your system for me? I'm curious if
it will work.

  If it works then we have a chance for making it work in IUP, CD and IM
with minimal changes. Usually the complicated stuff will be in IUP because
of the use interaction with the filename.

Thanks,
Scuri




Em dom, 9 de set de 2018 às 21:44, Andrew Robinson <[email protected]>
escreveu:

> It is IM. I came across the same problem and already reported it to
> Antonio.
>
> On 2018-09-09 at 2:59 AM, 云履 <[email protected]> wrote:
>
> Demo:
>
>  p=require'iuplua'
>  im=require'imlua'--true
>  pli=require'iupluaim'--true
>  ihandle=p.LoadImage[[C:\Path Or Name Contains Chinese (multi-bytes
> characters) like 中文.png]]--Failed.
>  --ihandle=p.LoadImage[[C:\Normal File Path And Name.png]]--OK.
>  if not ihandle then
>   print(p.GetGlobal'IUPIM_LASTERROR')--'Error Opening Image File.'
>  end
>
> Not sure if it is related to IUP or IM.
> Is there any conversion function can work, from file name and path where
> better to keep its original names which isn't pure English character.
>
>
> _______________________________________________
> 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