Bug #74364
Issue with LANG environment variable
100%
Description
I am getting the following error:
Cannot build Sphinx project:
cd '/home/cbrunet/Web/paroisse/typo3temp/tx_sphinx/cb_foundation/' && export PYTHONPATH=/usr/lib/python && export COLORTERM=1 && '/usr/bin/sphinx-build' -b html -c '_make/' -d '_make/build/doctrees' -w warnings.txt '.' '_make/build/html' 2>&1
Failed to import the site module
Traceback (most recent call last):
File "/usr/lib/python3.5/site.py", line 563, in
main()
File "/usr/lib/python3.5/site.py", line 550, in main
known_paths = addsitepackages(known_paths)
File "/usr/lib/python3.5/site.py", line 327, in addsitepackages
addsitedir(sitedir, known_paths)
File "/usr/lib/python3.5/site.py", line 206, in addsitedir
addpackage(sitedir, name, known_paths)
File "/usr/lib/python3.5/site.py", line 162, in addpackage
for n, line in enumerate(f):
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 56: ordinal not in range(128)
The same command in a terminal works without errors. I realized that the problem is that LANG of the shell used by the PHP exec command is probably C, while I need it to be UTF-8.
I solved the problem adding
$exports[] = MiscUtility::getExportCommand('LANG', 'fr_CA.UTF-8');
at line 752 of SphinxBuilder.php. This is probably very specific to my environment, but I think there should be a way to set the LANG variable for the command executed.
Updated by Xavier Perseguers almost 5 years ago
- Target version set to 2.4.0
Probably a way could be to fetch this locale from TYPO3 or from configuration in php.ini
.
Updated by Xavier Perseguers about 4 years ago
- Status changed from New to Accepted
- Assignee set to Xavier Perseguers
Could reproduce the problem with my environment, on macOS.
Updated by Gerrit Code Review about 4 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project TYPO3CMS/Extensions/sphinx has been pushed to the review server.
It is available at https://review.typo3.org/51149
Updated by Xavier Perseguers about 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset cb59f88f36b3932dd3779196cd3c3911d54e6e24.