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



Robert Harris wrote:
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 !

[...]

The only portable solution is to use UNICODE everywhere!

Robert

Yes, well, my app only reads directories (to compare them), so even if I use UNICODE, I still need the encoding the others have used when they created the directories and files. I want my tool to work with all the files, everywhere. That is what portability is about. Unfortunately POSIX only gives me a binary char[] array for the file name.

Timothy Madden,
Romania.
.



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