I have at the moment an issue with UTF8 in combincation with Jenkins. Our project is build in PHP and we use as servers Ubuntu servers.
Now is the problem that the encoding not works correctly. We have on different environments everything working, but only our jenkins server fails.
To test this, i have made a few test outputs in a unittests. This i let run and read the output. this is the script and responses:
<?php
$str = 'téëst';
var_dump(
array(
mb_http_input(),
mb_http_output(),
mb_detect_order(),
utf8_decode($str),
utf8_decode(utf8_decode($str)),
utf8_encode($str),
utf8_encode(utf8_encode($str)),
$str,
mb_detect_encoding($str)
)
);
?>
This is our live environment / staging environment and development environment:
array(9) {
[0] =>
bool(false)
[1] =>
string(4) "pass"
[2] =>
array(2) {
[0] =>
string(5) "ASCII"
[1] =>
string(5) "UTF-8"
}
[3] =>
string(5) "t��st"
[4] =>
string(5) "t??st"
[5] =>
string(11) "téëst"
[6] =>
string(19) "téëst"
[7] =>
string(7) "téëst"
[8] =>
string(5) "UTF-8"
}
As you can see, works de normal string, without converting. But now on the Jenkins environment, it runs on the same computer as our development environment, where it works all fine.
This is the result of it:
[exec] array(9) {
[exec] [0] =>
[exec] bool(false)
[exec] [1] =>
[exec] string(4) "pass"
[exec] [2] =>
[exec] array(2) {
[exec] [0] =>
[exec] string(5) "ASCII"
[exec] [1] =>
[exec] string(5) "UTF-8"
[exec] }
[exec] [3] =>
[exec] string(5) "t??st"
[exec] [4] =>
[exec] string(5) "t??st"
[exec] [5] =>
[exec] string(11) "t????????st"
[exec] [6] =>
[exec] string(19) "t????????????????st"
[exec] [7] =>
[exec] string(7) "t????st"
[exec] [8] =>
[exec] string(5) "UTF-8"
[exec] }
As shown above, all encodings options fails, also the normal string.
I have already tried different things, by example:
- change in the pom.xml files the encoding to UTF-8.
- change the JAVA_ARGS to: JAVA_ARGS="-Dfile.encoding=UTF-8"
- add JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
- add JENKINS_TOOL_OPTIONS="-Dfile.encoding=UTF8"
- add JENKINS_ARGS="-Dfile.encoding=UTF8 ...."
None of the options works. I have runned the tests also logged in as our jenkins user to verify if it is his workings space, but also not.
Can someone help me in the good direction? Only this is between us and CI development.
Thanks in advance.