Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2025-02-09 16:45:42

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 209
Website

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

#2 2025-02-10 18:27:51

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 209
Website

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

Board footer

Powered by FluxBB