Page 1 of 1

XnView and DOS 8.3 names

Posted: Sat Aug 22, 2015 1:51 am
by uRsti11anError
I know XnView classic does not support Unicode in filenames (or at least doesn't support characters from foreign locales) and I'm not going to demand it. I know as well XnViewMP can do that, but my need for viewing such files is very rare and often they just can be renamed for doing this in classic version. The following is not direct suggestion, but rather a curiosity.

I just want to ask if XnView classic could potentially make some more use of one trick than it does now.
Preparations:
- any graphic file XnView can open;
- access to Unicode font which not belongs to your locale;
- Windows console cmd.exe.
I took from wiki page for Norwegian alphabet letter "ø" and renamed one .bmp file on disk L:\ to "ø.bmp". As expected, XnView reported an error on attempt of opening it.
Next I have opened cmd on L:\ and issued command "dir /x *.bmp". That gave me short DOS-alike name in 8.3 format for this file.
In my case it was "24FD~1.BMP", though files with the same name and different extensions get different name part.
Then I have started XnView, menu File->Open, typed full path in DOS-style "L:\24FD~1.BMP" in filename field, clicked Open and landed in HEX viewer mode. Why XnView ever has it, you can't edit file and font is too small. But contents of file were correct.
If you do the same with file which does not contain foreign characters in its name (i.e. convert to DOS 8.3 and feed this way to XnView), then XnView opens it in Viewer mode.

So, can anything be done to have something more from ability to read Unicode named files with HEX viewer?
Like button "show as image" in HEX Viewer, or "Copy to temporary memory block and open", or hardcore "DOS 8.3" mode for XnView Browser, or menu "File->Open using DOS names"?

This method works with XVI32 HEX Editor. It can not open Unicode named files, but can access them and correctly save changes if path is given in DOS-style. Of course, XnView is more complicated software.

P.S. With HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation not set to 0 in registry all this idea goes kaput.

Re: XnView and DOS 8.3 names

Posted: Sun Aug 23, 2015 3:13 pm
by xnview
yes an idea, but user that open ø.bmp will be very surprised if the name becomes 24FD~1 :)

Re: XnView and DOS 8.3 names

Posted: Wed Aug 26, 2015 11:33 pm
by uRsti11anError
Let's hope user who open ø.bmp in XnView is working in Norwegian/Danish locale and will succeed.

But for me personally this idea was so attractive that I with my limited programming experience and with help of World Wide Library have adapted this example to shell extension which allows to copy short DOS name of selected file to clipboard (just couldn't find such extension ready-to-use, others I know copy filename, URL but not DOS). Compiled in VS6 on Win2k, tested this .dll on XP as well. With little adventures project was converted to VS 2010 on Win7 x64, compiled and tested there too.
Ultimate Paint (an old image editor) which doesn't understand Unicode can successfully open .bmp from the path of maximal length consisting mostly of kanji when given short DOS name.

Could you please not dump valid image data into HEX viewer if XnView can't display preview in "Open picture" window but send them to decoder? Or at least add checkbox "try to open in Viewer anyway" if file looks doubtful? "Open picture" shows more files than XnView Browser if some of them include Unicode characters (kanji in XnView Browser is replaced with ??, while in Open dialog they look fine), so it would be possible to right-click such file and copypaste DOS name straight to filename field. If in XnView Browser is enabled filtering by graphics file type then Unicode named files are not displayed at all.
I'm not trying to be annoying (that's probably my natural quality), but does XnView Classic have some nuance in its architecture which obstructs sending data to somewhere else than HEX viewer?