Is there a wchar_t
version of exec[lv][pe]
(i.e. an exec
that uses wchar_t
as path and wchar_t
as arguments)?
In Windows
, I can just do CreateProcessW(process, cmdline)
, but in *nix
, I'm stuck (i.e. no pure POSIX
equivalent).
I'm trying to add UTF-16
support to my program (an autorun).
Asked
Active
Viewed 971 times
4

dragosht
- 3,237
- 2
- 23
- 32
2 Answers
4
There is not. In UNIX, it's customary to use UTF-8 when interacting with the environment.

John Millikin
- 197,344
- 39
- 212
- 226
-
Is exec[lv][pe]* UTF-8-aware? – Sep 28 '08 at 06:57
-
That's the beauty of UTF-8 -- they don't have to be. Any functions that operate on NULL-terminated bytes (AKA almost every one) will work with UTF-8. – John Millikin Sep 28 '08 at 07:01
-
1in Unix, it's customary to use ASCII when interacting with the environment. – hillu Jul 24 '09 at 08:52
2
There is a problem though: the file system on UNIX/Linux is encoding-agnostic. All file names are just "a bunch of bytes"
So if I do a LANG=ja_JAP.EUC_JP, create a file with Japanese name, then I do a LANG=ja_JP.UTF8, when I look at my file name will look like junk, and it will be an invalid UTF-8 string.
You might say: why do that? But imagine you have a system used by hundreds of international users, each of them using Russian/Chinese/Korean/Arabic files, and you have to write a backup application :-(
The "solution" is to ask everybody to set the locale to something.UTF8, but that is just a convention, the system itself does not enforce anything.

Mihai Nita
- 5,547
- 27
- 27