please add support for unicode filenames

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, helmut, xnview

Post Reply
tuitfun
Posts: 1
Joined: Wed Sep 12, 2007 3:11 pm

please add support for unicode filenames

Post by tuitfun »

Hello,

XnView is now ignoring all files and directories whose names have unicode characters, e.g. 你好世界. Please add support for unicode filenames.

There're two problems in windows with unicode filenames. The first one is that the regular c functions, e.g. open() stat(), do not work if the filename has unicode characters, e.g. 你好世界. We need to use the wide character functions instead, e.g. _wopen(), _wstat().

In mingw (or similarly in MSVC), a header file, tchar.h, exists to make it easier to work in both unicode & non-unicode systems. basically tchar.h has something like:
#ifdef _UNICODE
typedef wchar_t TCHAR;
#define _topen _wopen
#define _tstat _wstat
#else
typedef char TCHAR;
#define _topen open
#define _tstat _stat
#endif
So, if we use TCHAR instead of char, and _topen() instead of open(), it'll get mapped correctly depending on whether _UNICODE is defined. Note that some microsoft functions check for UNICODE not _UNICODE, so we'll need to define both. For more information about this, please see http://sourceforge.net/mailarchive/mess ... .yahoo.com particularly the replies from Tor Lillqvist.

The second problem is that the command line arguments in main() (*argv[]) would get encoded incorrectly if unicode arguments are used. We can use __wgetmainargs() to get the wide character arguments instead.

Once we have the wide character strings, we convert them to utf-8 so we can pass them around in functions which expect char *; and we convert them back to wide char strings just before calling the _wopen(). For more information, please see http://sourceforge.net/mailarchive/mess ... .yahoo.com

tuit
Conqueror
Posts: 11
Joined: Mon Dec 07, 2009 5:03 am

Re: please add support for unicode filenames

Post by Conqueror »

After 4 years, this request has still not been fulfilled. XnView is very limited to western languages only. No support for Eastern languages?
I'm using English version of windows 7 64 bit, but can't open files which have unicode characters in it's path.
User avatar
xnview
Author of XnView
Posts: 43601
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: please add support for unicode filenames

Post by xnview »

XnViewMP has native UNICODE support...
Pierre.
Conqueror
Posts: 11
Joined: Mon Dec 07, 2009 5:03 am

Re: please add support for unicode filenames

Post by Conqueror »

Thanks. I'll try it.
User avatar
V@no
Posts: 35
Joined: Sun Feb 25, 2007 8:06 pm

Re: please add support for unicode filenames

Post by V@no »

xnview wrote:XnViewMP has native UNICODE support...
And it has 1/100 of XnView features...tough choice.
User avatar
xnview
Author of XnView
Posts: 43601
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: please add support for unicode filenames

Post by xnview »

V@no wrote:
xnview wrote:XnViewMP has native UNICODE support...
And it has 1/100 of XnView features...tough choice.
No almost 50%, new version will be available soon...
Pierre.
User avatar
d03g03l
Posts: 7
Joined: Wed Apr 27, 2011 5:46 am
Contact:

Re: please add support for unicode filenames

Post by d03g03l »

if so, can u open this files? :(
:| :bug:
Attachments
CanUOpenThis¿.zip
Download, Extract n open with Xnview...
(157.16 KiB) Downloaded 99 times
User avatar
xnview
Author of XnView
Posts: 43601
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: please add support for unicode filenames

Post by xnview »

d03g03l wrote:if so, can u open this files? :(
:| :bug:
With XnViewMP?
Pierre.
Post Reply