initialize default locale
Changes to use xlocale fixed problems with places and locale settings, but it caused the initial process-wide locale to stay with the C locale, which is bad for things like libedit. To get the good part of the old behavior bback, set the process-wide locale to "" on startup.
This commit is contained in:
parent
8a9a6fe936
commit
dcaa20b411
|
@ -726,6 +726,8 @@ static int run_from_cmd_line(int argc, char *_argv[],
|
|||
FinishArgs *fa;
|
||||
FinishArgsAtoms *fa_a;
|
||||
|
||||
scheme_set_default_locale();
|
||||
|
||||
prog = argv[0];
|
||||
argv++;
|
||||
--argc;
|
||||
|
|
|
@ -2002,6 +2002,8 @@ MZ_EXTERN Scheme_Object *scheme_param_config2(char *name, Scheme_Object *pos,
|
|||
int isbool);
|
||||
MZ_EXTERN Scheme_Object *scheme_register_parameter(Scheme_Prim *function, char *name, int which);
|
||||
|
||||
MZ_EXTERN void scheme_set_default_locale(void);
|
||||
|
||||
#endif /* SCHEME_DIRECT_EMBEDDED */
|
||||
|
||||
/*========================================================================*/
|
||||
|
|
|
@ -3448,6 +3448,11 @@ void scheme_pop_c_numeric_locale(char *prev)
|
|||
rktio_pop_c_numeric_locale(scheme_rktio, prev);
|
||||
}
|
||||
|
||||
void scheme_set_default_locale(void)
|
||||
{
|
||||
rktio_set_default_locale("");
|
||||
}
|
||||
|
||||
static int find_special_casing(int ch)
|
||||
{
|
||||
/* Binary search */
|
||||
|
|
|
@ -3374,6 +3374,8 @@
|
|||
(define rktio_strcoll_utf16 (hash-ref rktio-table 'rktio_strcoll_utf16))
|
||||
(define rktio_locale_encoding (hash-ref rktio-table 'rktio_locale_encoding))
|
||||
(define rktio_set_locale (hash-ref rktio-table 'rktio_set_locale))
|
||||
(define rktio_set_default_locale
|
||||
(hash-ref rktio-table 'rktio_set_default_locale))
|
||||
(define rktio_push_c_numeric_locale
|
||||
(hash-ref rktio-table 'rktio_push_c_numeric_locale))
|
||||
(define rktio_pop_c_numeric_locale
|
||||
|
@ -15634,6 +15636,7 @@
|
|||
rktio_set_locale
|
||||
(unsafe-place-local-ref cell.1)
|
||||
(1/string->bytes/utf-8 (unsafe-place-local-ref cell.1$8))))))))
|
||||
(define effect_2455 (begin (void (|#%app| rktio_set_default_locale #vu8())) (void)))
|
||||
(define effect_2454 (begin (void (sync-locale!)) (void)))
|
||||
(define locale-encoding-is-utf-8?
|
||||
(lambda ()
|
||||
|
@ -35992,11 +35995,11 @@
|
|||
'subprocess
|
||||
"(or/c (and/c output-port? file-stream-port?) #f 'stdout)"
|
||||
stderr_0))
|
||||
(let ((lr3723 unsafe-undefined)
|
||||
(let ((lr3726 unsafe-undefined)
|
||||
(group_0 unsafe-undefined)
|
||||
(command_0 unsafe-undefined)
|
||||
(exact/args_0 unsafe-undefined))
|
||||
(set! lr3723
|
||||
(set! lr3726
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(if (path-string? group/command_0)
|
||||
|
@ -36051,9 +36054,9 @@
|
|||
((group_1 command_1 exact/args_1)
|
||||
(vector group_1 command_1 exact/args_1))
|
||||
(args (raise-binding-result-arity-error 3 args)))))
|
||||
(set! group_0 (unsafe-vector*-ref lr3723 0))
|
||||
(set! command_0 (unsafe-vector*-ref lr3723 1))
|
||||
(set! exact/args_0 (unsafe-vector*-ref lr3723 2))
|
||||
(set! group_0 (unsafe-vector*-ref lr3726 0))
|
||||
(set! command_0 (unsafe-vector*-ref lr3726 1))
|
||||
(set! exact/args_0 (unsafe-vector*-ref lr3726 2))
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(if (if (pair? exact/args_0)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
(set! installed-locale (current-locale))
|
||||
(rktio_set_locale rktio (string->bytes/utf-8 installed-locale))))
|
||||
|
||||
(void (rktio_set_default_locale #""))
|
||||
(void (sync-locale!))
|
||||
|
||||
(define (locale-encoding-is-utf-8?)
|
||||
|
|
|
@ -187,6 +187,7 @@ rktio_locale_strcoll
|
|||
rktio_strcoll_utf16
|
||||
rktio_locale_encoding
|
||||
rktio_set_locale
|
||||
rktio_set_default_locale
|
||||
rktio_push_c_numeric_locale
|
||||
rktio_pop_c_numeric_locale
|
||||
rktio_system_language_country
|
||||
|
|
|
@ -1203,6 +1203,9 @@ RKTIO_EXTERN void rktio_set_locale(rktio_t *rktio, rktio_const_string_t name);
|
|||
string corresponds to the OS's native locale, and a NULL string
|
||||
pointer corresponds to the C locale. */
|
||||
|
||||
RKTIO_EXTERN void rktio_set_default_locale(rktio_const_string_t name);
|
||||
/* Similar to rktio_set_locale(), but sets the locale process-wide. */
|
||||
|
||||
RKTIO_EXTERN_NOERR void *rktio_push_c_numeric_locale(rktio_t *rktio);
|
||||
RKTIO_EXTERN void rktio_pop_c_numeric_locale(rktio_t *rktio, void *prev);
|
||||
/* Use this pair of functions to temporarily switch the locale to the
|
||||
|
|
|
@ -187,6 +187,7 @@ Sforeign_symbol("rktio_locale_strcoll", (void *)rktio_locale_strcoll);
|
|||
Sforeign_symbol("rktio_strcoll_utf16", (void *)rktio_strcoll_utf16);
|
||||
Sforeign_symbol("rktio_locale_encoding", (void *)rktio_locale_encoding);
|
||||
Sforeign_symbol("rktio_set_locale", (void *)rktio_set_locale);
|
||||
Sforeign_symbol("rktio_set_default_locale", (void *)rktio_set_default_locale);
|
||||
Sforeign_symbol("rktio_push_c_numeric_locale", (void *)rktio_push_c_numeric_locale);
|
||||
Sforeign_symbol("rktio_pop_c_numeric_locale", (void *)rktio_pop_c_numeric_locale);
|
||||
Sforeign_symbol("rktio_system_language_country", (void *)rktio_system_language_country);
|
||||
|
|
|
@ -1336,6 +1336,11 @@
|
|||
void
|
||||
rktio_set_locale
|
||||
(((ref rktio_t) rktio) (rktio_const_string_t name)))
|
||||
(define-function
|
||||
()
|
||||
void
|
||||
rktio_set_default_locale
|
||||
((rktio_const_string_t name)))
|
||||
(define-function
|
||||
()
|
||||
(ref void)
|
||||
|
|
|
@ -266,6 +266,11 @@ void rktio_set_locale(rktio_t *rktio, const char *name)
|
|||
#endif
|
||||
}
|
||||
|
||||
void rktio_set_default_locale(const char *name)
|
||||
{
|
||||
setlocale(LC_ALL, name);
|
||||
}
|
||||
|
||||
void *rktio_push_c_numeric_locale(rktio_t *rktio)
|
||||
{
|
||||
#ifdef RKTIO_USE_XLOCALE
|
||||
|
|
Loading…
Reference in New Issue
Block a user