On Wed, 18 Sep 2002 21:20:30 +0200 Bruno Haible <[EMAIL PROTECTED]> wrote:
> Martin Kochanski writes: > > > how can a poor innocent server discover enough about the > > context in which it is running to know what filename it has to > > use so that a > > user who lists a file directory will see "R�ve" on his screen? > > Since it depends on the user's locale, you'll have to convert the > filename from the given encoding to the user's locale encoding. > Start out with > > const char *given_encoding = "UTF-8"; > // or "UTF-16", depends on what you have > const char *localedependent = ""; > // shortcut for glibc or libiconv > iconv_t cd = iconv_open (localedependent, given_encoding); > ... Or with encdec: char buf[PATH_MAX]; const char *src = given_string; dec_mbsncpy(&src, -1, buf, PATH_MAX, -1, given_encoding); puts(buf); done. -- A program should be written to model the concepts of the task it performs rather than the physical world or a process because this maximizes the potential for it to be applied to tasks that are conceptually similar and more importantly to tasks that have not yet been conceived. -- Linux-UTF8: i18n of Linux on all levels Archive: http://mail.nl.linux.org/linux-utf8/
