Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
setlocale() fails inside Txp
My website uses C programs to digest HTML forms and compute stuff, so the structure is Textpattern -> php: proc_open( <path-to-C-executable-in-cgi-bin> )
. I want to set the locale for the C program. If I run the C program directly from the browser, setlocale()
finds “en_US”. However, when the same program is run as txp->php->C, setlocale()
fails, and the only locales available are the defaults, “C” and “POSIX”.
The server is some Debian variant. The “documentation” (man 7 locale) hints that the environment variable “LOCPATH” could break stuff, but LOCPATH isn’t set. I don’t see any other external handles on the behaviour of setlocale()
in the documentation that could break it.
Is Textpattern or php doing something weird that would break a posix system call? (Well, yes. But what?)
Offline
Re: setlocale() fails inside Txp
I got what I needed done by the evil hack of creating my own locale definition by using localedef
and then pointing LOCPATH
to it. Gross and unsatisfying, but it works for my narrow use case.
Offline