4

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).

dragosht
  • 3,237
  • 2
  • 23
  • 32

2 Answers2

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
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