2

I am using tinyfiledialogs lib and i am able to save files in folders which names are in English but when i try to save the exact same file in folder which name is like for example "Кот" in other words in Russian letter i could not.

This is the code

IntPtr p = tinyfd_saveFileDialog(sDialogTitle, sInitialPathAndFile, 
            filterPatterns.Length, filterPatterns, sPatternDesc);

This is defined in somelib that i am using

        [DllImport("tinyfiledialogs", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr tinyfd_saveFileDialog(string aTitle, string aDefaultPathAndFile, int aNumOfFilterPatterns, string[] aFilterPatterns, string aSingleFilterDescription);

Any help?I am newbee to this lib and could not find any essential information regarding this.

So_oP
  • 1,211
  • 15
  • 31

2 Answers2

2

The library appears to export both ANSI and Unicode versions (i.e. A and W suffixes) of its functions. So you should just be able to change

CharSet = CharSet.Ansi

to

CharSet = CharSet.Unicode

and the pinvoke marshaler will do the rest.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
2

UPDATE: I've just corrected many things in the C# import of the DLLs. Can you give a try to version 3.6.0 with the new DLLs ?

I am the author of tinyfiledialogs. First make sure you are getting it from the sourceforge site https://sourceforge.net/projects/tinyfiledialogs and not from any of the github copies (generally out of date).

As reported you should use the UTF-16 (wchar_t - CharSet = CharSet.Unicode) calls. But UTF-8 (char = CharSet.Ansi) also works now.

tinyfiledialogs
  • 1,111
  • 9
  • 18
  • how can i know which source i am using? And how can i get the source from sourcfroge site?Any links? – So_oP Apr 14 '20 at 21:22
  • 1
    Yep you were right, i have downloaded the latest version of your library and it seems like it is working correctly.I have been using old version so far. Which had some issues with non English named folders.Anyway thank you. – So_oP Apr 22 '20 at 16:00
  • Hi again, could you please tell me is there pecific version of your library for macOs or this dll's should wokork fine on both windows and macOs? – So_oP Apr 28 '20 at 13:31
  • I have just added the .dylib file to the zip file on sourceforge. But you could produce it yourself, like this: "clang -c tinyfiledialogs.c" and then "clang -dynamiclib tinyfiledialogs.o -o tinyfiledialogs.dylib". – tinyfiledialogs Apr 28 '20 at 19:00