Re: Any portable way get a filename in UTF-8 or to get the FS encoding ?



Timothy Madden wrote:
Fredrik Roubert wrote:
On Sun, 07 Oct 2007 22:22:12 +0300, Timothy Madden wrote:
[...]
A process that wants to interpret the bytes that makes up a file name
must look at its environment for hints about which encoding the user
wants those file names to be interpreted as (eg. the LC_* environment
variables). You can use the mbstowcs() library function to automatically
convert a string into a wide character string according to the encoding
specified by the current environment.

How about files from a remote file system ? Than I am out of luck !

I use to connect through VPN, at work, to my client's LAN. They use Latin-1, I use Latin-2.

How can I tell that programmatically and portably ? My app has to work with files from both machines.

I would like a standard way to get that encoding, and the file system should be the first to know about it.

I guess I will just have to rely on the user passing the encoding for files whose names I process on the command line, or else assume the LC_* default.

This is not allways possible, for example when simply browsing the FS (like the GUI shell does), you can not ask the user for the encoding of files before browsing ...

I would like POSIX to fix this problem.

P.S. Fortunately me and my client have only used 7-bit ASCII characters in file names until now.

Thank you,
Timothy Madden,
Romania

The only portable solution is to use UNICODE everywhere!

Robert
.



Relevant Pages

  • Re: garbled asian text
    ... >> Roland Bierlein wrote: ... Here is a description of the environment where this ... instruction more precise, ... in the Default encoding are readable in the List Of Subjects. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Any portable way get a filename in UTF-8 or to get the FS encoding ?
    ... wants those file names to be interpreted as (eg. the LC_* environment ... convert a string into a wide character string according to the encoding ... For example I have a piece of spam in my inbox with a subject of =? ... I don't care cause it's spam and I can't read Japanese anyway.) ...
    (comp.unix.programmer)
  • Re: Any portable way get a filename in UTF-8 or to get the FS encoding ?
    ... must look at its environment for hints about which encoding the user ... wants those file names to be interpreted as (eg. the LC_* environment ... convert a string into a wide character string according to the encoding ...
    (comp.unix.programmer)
  • Re: Any portable way get a filename in UTF-8 or to get the FS encoding ?
    ... wants those file names to be interpreted as (eg. the LC_* environment ... convert a string into a wide character string according to the encoding ... For example I have a piece of spam in my inbox with a subject of =? ... I don't care cause it's spam and I can't read Japanese anyway.) ...
    (comp.unix.programmer)
  • Re: Any portable way get a filename in UTF-8 or to get the FS encoding ?
    ... wants those file names to be interpreted as (eg. the LC_* environment ... convert a string into a wide character string according to the encoding ... They use Latin-1, I use Latin-2. ...
    (comp.unix.programmer)