PolMine / RcppCWB

'Rcpp' Bindings for the 'Corpus Workbench' (CWB)
Other
2 stars 3 forks source link

cqp_initialize() changes locale (!) #46

Closed ablaette closed 2 years ago

ablaette commented 2 years ago

RcppCWB v4.4.9004 has one major flaw: Callingcqp_initialize() changes the locale.

Sys.getlocale()

"de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8" in my case

Then load RcppCWB and run ` cqp_initialize():

 library(RcppCWB)
 Sys.getlocale()
cqp_initialize()
Sys.getlocale()

"C"

This is hard to understand and certainly a totally unintended side-effect had to find. Realized in only when running reverse dependency checks with polmineR and inspecting .Rout files for examples and tests. Fortunately, polmineR issues a warning if the locale is "C".

ablaette commented 2 years ago

Indeed, cl_startup() (cwb/cl/globals.c) is the villain. See PatchCWB.R for an explanation why and how this is addressed.