diff options
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: utf8.c,v 1.7 2017/05/31 09:15:42 deraadt Exp $ */ | 1 | /* $OpenBSD: utf8.c,v 1.8 2018/08/21 13:56:27 schwarze Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
4 | * | 4 | * |
@@ -53,6 +53,8 @@ static int vasnmprintf(char **, size_t, int *, const char *, va_list); | |||
53 | * For state-dependent encodings, recovery is impossible. | 53 | * For state-dependent encodings, recovery is impossible. |
54 | * For arbitrary encodings, replacement of non-printable | 54 | * For arbitrary encodings, replacement of non-printable |
55 | * characters would be non-trivial and too fragile. | 55 | * characters would be non-trivial and too fragile. |
56 | * The comments indicate what nl_langinfo(CODESET) | ||
57 | * returns for US-ASCII on various operating systems. | ||
56 | */ | 58 | */ |
57 | 59 | ||
58 | static int | 60 | static int |
@@ -60,9 +62,12 @@ dangerous_locale(void) { | |||
60 | char *loc; | 62 | char *loc; |
61 | 63 | ||
62 | loc = nl_langinfo(CODESET); | 64 | loc = nl_langinfo(CODESET); |
63 | return strcmp(loc, "US-ASCII") != 0 && strcmp(loc, "UTF-8") != 0 && | 65 | return strcmp(loc, "UTF-8") != 0 && |
64 | strcmp(loc, "ANSI_X3.4-1968") != 0 && strcmp(loc, "646") != 0 && | 66 | strcmp(loc, "US-ASCII") != 0 && /* OpenBSD */ |
65 | strcmp(loc, "") != 0; | 67 | strcmp(loc, "ANSI_X3.4-1968") != 0 && /* Linux */ |
68 | strcmp(loc, "ISO8859-1") != 0 && /* AIX */ | ||
69 | strcmp(loc, "646") != 0 && /* Solaris, NetBSD */ | ||
70 | strcmp(loc, "") != 0; /* Solaris 6 */ | ||
66 | } | 71 | } |
67 | 72 | ||
68 | static int | 73 | static int |