Unicode names

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: helmut, XnTriq, xnview

Post Reply
Alessandro

Unicode names

Post by Alessandro »

Hi,

looks like in gflib and xnview char* filenames were used in place of tchar so people which uses unicode characters like in japan or china can't view their images...
am I wrong?

Best regards
User avatar
xnview
Author of XnView
Posts: 46236
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Unicode names

Post by xnview »

Alessandro wrote:Hi,

looks like in gflib and xnview char* filenames were used in place of tchar so people which uses unicode characters like in japan or china can't view their images...
am I wrong?
Yes, i use char* but you can convert UNICODE to multibyte
Pierre.
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Re: Unicode names

Post by MaierMan »

xnview wrote:Yes, i use char* but you can convert UNICODE to multibyte
You can't actually.
Works if the filename only contains char representable by the system locale.
But won't work with "real" WideChar filenames.
E.g. I won't be able to open files with arab chars in the name under my de-DE Windows ;)

Workaround is to use gflLoad*FromHandle + Callbacks + CreateFileW (under Windows)

There should be a "Windows only" set of wchar_t* enabled functions.
(*nix doesn't really support WideChar filenames FWIK, instead it will use UTF-8 encoded char*, if at all...)
Alessandro

Post by Alessandro »

actually I think I can also use _wfopen for this purpose, tough I couldn't get a valid FILE * value yet.
Except this I also wonder what the result values should be... GFL_ERROR & GFL_NO_ERROR in read and seek callbacks, and the position in tell? and are those 3 function enough to make gfllib work only to read files or should I define a wrapper for write too?
how bothersome... :(
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post by MaierMan »

I have a small unicode layer built into gflW, the C++ Wrapper, that demonstrates the use of callbacks.
It's not really good, but it does it job.
Maybe you can get some ideas from it ;)

http://celebnamer.celebworld.ws/stuff/libgflW/
Guest

Post by Guest »

Thanks, that helped with callbacks, unfortunately I discoverd that Builder is a nightmare to write unicode code, but that's a different story...

Thanks again!
Post Reply