[Bug 1632] [PATCH] UTF-8 hint sftp-server extension

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Tue Jan 12 00:55:58 EST 2010


--- Comment #18 from Salvador Fandiño <sfandino at yahoo.com> 2010-01-12 00:55:57 EST ---
(In reply to comment #17)
> >+			setlocale(LC_CTYPE, "");
> Wouldn't the user locale be better use than the system locale? Each
> user may be using their own filename encoding...

Latest POSIX standard mandates that setlocale(..., "") must get the
locale configuration from environment variables that, in our particular
case, can be set by the user in ~/.ssh/environment or by the system,
for instance, via pam. See
Linux, Solaris and probably several other Unixes libc libraries already
follow that standard.

AFAIK, OpenBSD does not. Actually it doesn't have any way to configure
the locale and applications have to do it in custom ways, as for
instance, reading it from a configuration file. That means that most
applications do not support locales under OpenBSD and always use the
default ("C"). The charset associated to "C" is 646 (ASCII), but in
practice, what you get is iso-5589-1 unless you customize the
console/X-Window configuration to use a different font.

> >+			filename_charset = nl_langinfo(CODESET);
> >+			setlocale(LC_CTYPE, "C");
> Wouldn't it be better to restore the original locale?

That's "C"!

Applications are always started with locale "C" and have to call
setlocale(...) explicitly to change to another one.

> >+			if ((strcmp(filename_charset, "646") == 0) ||
> >+			    (strcmp(filename_charset, "ANSI_X3.4-1968") == 0))
> >+				filename_charset = "ISO-8859-1";
> How are these heuristics determined?

The idea is that when ASCII is returned as the charset, what it really
means is that locale has probably not been configured and that the
charset is iso8859-1.

The OS could be configured to use a non iso8859-1 charset/font via
wsfontload or similar, but then sftp-server can also be customized via
"-s charset".

> Are there other aliases that we need to be aware of?

probably yes, "646" and "ANSI_X3.4-1968" is what you get from locale
"C" in OpenBSD and Linux respectively.

Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.

More information about the openssh-bugs mailing list