cs: initialize locale on startup

The `current-locale` parameer value is transferred to the C lbrary via
`setlocale` on demand by Racket functions that depend on the locale,
but some libraries (like libedit) can also depend on the locale
setting. By default, the C library starts with the "C" locale, so it's
worthwhile to install the default locale on startup, even if that's
not a complete solution to support changes to `current-locale`.
This commit is contained in:
Matthew Flatt 2020-08-27 10:47:41 -06:00
parent 38570e3ea6
commit e5899bd3e6
3 changed files with 395 additions and 388 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,8 @@
(set! installed-locale (current-locale))
(rktio_set_locale rktio (string->bytes/utf-8 installed-locale))))
(void (sync-locale!))
(define (locale-encoding-is-utf-8?)
(define t (system-type))
(define loc (current-locale))

View File

@ -33,6 +33,8 @@
shared-ltps-place-init!)
(only-in "locale/cache.rkt"
convert-cache-init!)
(only-in "locale/parameter.rkt"
sync-locale!)
"port/place.rkt")
(provide (all-from-out "port/main.rkt")
@ -69,7 +71,8 @@
(shared-ltps-place-init!)
(install-error-value->string-handler!)
(init-current-directory!)
(init-current-ports! in-fd out-fd err-fd cust plumber))
(init-current-ports! in-fd out-fd err-fd cust plumber)
(sync-locale!))
(define (io-place-destroy!)
;; We expect everything based on rktio to be destroyed at this point