[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing unicode filenames to start-process on Windows?

From: Klaus-Dieter Bauer
Subject: Re: Passing unicode filenames to start-process on Windows?
Date: Fri, 8 Jan 2016 00:31:38 +0100

2016-01-07 17:00 GMT+01:00 Eli Zaretskii <address@hidden>:
> From: Klaus-Dieter Bauer <address@hidden>
> Date: Wed, 6 Jan 2016 22:19:39 +0100
> Cc: address@hidden
> I thought up some workarounds, but they all run into limitations:
> * w32-short-file-name: Doesn't work, because in modern Windows systems 8.3 file
>   names may not be generated, so it may just return the unchanged filename.
> * rename-file: Allows working with a name via a temporary supported file name.
>   Sadly there is no way to guarantee that such renaming is undone afterwards.
> * copy-file (to a temporary directory): Would work for the current application,
>   but unviable when larger amounts of data are involved.
> Would you happen to know any other possible workaround?

The only one that would work reliably is to pass arguments via a file
or a pipe.  (Some program support "response files" as a replacement
for command-line arguments, or can read the arguments from stdin.)

Do you really have programs that can support text outside of the
current system codepage?  If you don't, then passing arguments with
such strings is the least of your problems: once you do get these
strings into the program, the program won't be able to do anything
useful with them: all the library functions that receive C strings
will misbehave, you won't be able to open files with such names, etc.

IOW, I'm not sure I understand your use case in enough detail to
provide useful advice.  Perhaps describe what you want to do and the
program you want to invoke from Emacs in more detail.

​I have two usecases where I run into the issue:

- I want at some point to write an incremental backup utility 
  that uses md5sum to identify renamed files. Since precompiled
  Windows binaries are 32bit, only the first 512MB of any given
  file are accessible to elisp however, so I wanted to use 
  GnuWin32's md5sum.exe (but it turns out that it doesn't 
  support unicode filenames anyway). 

- I want to verify a convention where filenames should mirror 
  the metadata in my music library. Here I intended to write 
  an elisp tool (for easy interactive processing im Emacs) 
  and tried to use ffmpeg (which does support unicode filenames
  in cmd.exe). 

I checked and both tools allow reading the input data from 
a pipe (`type UNICODE.mp3 | ffmpeg -i - ...` or `md5sum` 
respectively), so that workaround is applicable to all my usecases. 

Thanks for the help!
- Klaus

reply via email to

[Prev in Thread] Current Thread [Next in Thread]