Subject: Re: UTF-8 file names?
To: SODA Noriyuki <soda@sra.co.jp>
From: Thomas Klausner <wiz@NetBSD.org>
List: tech-userlevel
Date: 09/25/2004 14:26:46
On Tue, Sep 14, 2004 at 09:00:49PM +0900, SODA Noriyuki wrote:
> >>>>> On Tue, 14 Sep 2004 13:43:37 +0200,
> 	Thomas Klausner <wiz@NetBSD.org> said:
>
> >> ls has a problem, because it is using isprint(3) instead of iswprint(3).
> >> You can work around the problem by using something like "ls | cat",
> >> though.
>
> > Should it be changed to use iswprint(3)?
>
> Yes.
> (To be sure, you cannot just use iswprint() as a substitute for
>  isprint(). It's need be written by using wchar_t. It's somewhat
>  easy change, though.)

The file name comes from fts(3). The structure there has:
     typedef struct _ftsent {
             u_short fts_info;               /* flags for FTSENT structure */
             char *fts_accpath;              /* access path */
             char *fts_path;                 /* root path */
             short fts_pathlen;              /* strlen(fts_path) */
             char *fts_name;                 /* file name */
             short fts_namelen;              /* strlen(fts_name) */
             short fts_level;                /* depth (-1 to N) */
             int fts_errno;                  /* file errno */
             long fts_number;                /* local numeric value */
             void *fts_pointer;              /* local address value */
             struct ftsent *fts_parent;      /* parent directory */
             struct ftsent *fts_link;        /* next file structure */
             struct ftsent *fts_cycle;       /* cycle structure */
             struct stat *fts_statp;         /* stat(2) information */
     } FTSENT;

We're using fts_name, which is a char *.
How can I convert it to wchar_t *?
 Thomas