diff options
author | Valentin Bartenev <vbart@nginx.com> | 2021-03-15 15:03:32 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2021-03-15 15:03:32 +0300 |
commit | 4c261a7ff8f2b2af08cc2cdee6828af4a1cf7794 (patch) | |
tree | 09ef8467beb97a5213c5587cc378499d5060a950 | |
parent | b0a1266835386590c65ec433759c5cc1063bd472 (diff) | |
download | unit-4c261a7ff8f2b2af08cc2cdee6828af4a1cf7794.tar.gz unit-4c261a7ff8f2b2af08cc2cdee6828af4a1cf7794.tar.bz2 |
Ruby: fixed encodings initialization.
The Ruby interpreter expects an explicit setlocale() call before initialization
to pick up character encodings in the "Encoding" class from the environment.
This closes #531 issue on GitHub.
Diffstat (limited to '')
-rw-r--r-- | docs/changes.xml | 6 | ||||
-rw-r--r-- | src/ruby/nxt_ruby.c | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/changes.xml b/docs/changes.xml index 07decb2a..2f68083d 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -37,6 +37,12 @@ Linux, and all uploaded certificate bundles were forgotten after restart. </para> </change> +<change type="bugfix"> +<para> +the Ruby module didn't respect user locale for defaults in the Encoding class. +</para> +</change> + </changes> diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c index 0aad887d..ca14af5b 100644 --- a/src/ruby/nxt_ruby.c +++ b/src/ruby/nxt_ruby.c @@ -12,6 +12,8 @@ #include NXT_RUBY_MOUNTS_H +#include <locale.h> + #define NXT_RUBY_RACK_API_VERSION_MAJOR 1 #define NXT_RUBY_RACK_API_VERSION_MINOR 3 @@ -200,6 +202,8 @@ nxt_ruby_start(nxt_task_t *task, nxt_process_data_t *data) nxt_ruby_threads = c->threads; + setlocale(LC_CTYPE, ""); + RUBY_INIT_STACK ruby_init(); ruby_options(2, argv); |