0

I am attempting to run a Cucumber (Ruby) Test Suite from Jenkins that tests whether or not 2-4 byte UTF-8 characters are valid names for groups.

I have tried a number of solutions and have been searching for days attempting to find an issue relevant to mine.

The error that has been haunting me is:

incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)

Which refers to a line where I am attempting to send an ssh command to the CLI on the FreeBSD machine I am creating the group on:

$mymachine.cli_ssh.exec!("config group create --name='#{group_name}'")

Where within the exec!() command exists:

command.force_encoding("UTF-8")

The error only occurs when I am sending 2-4 byte UTF-8 characters, such that:

Group 'abcd' does not cause the error and Group 'ЯЯЯ' does cause the error

The problem:

Running this script on my local Ubuntu machine works perfectly fine, as well as other machines in my area. (which is why I do not think it is necessary to provide more code than is given)

I have already tried establishing system locales on the Jenkins machine as en_US.UTF-8 both as locale system variables and within the /.bashrc file. No where have I seen an encoding variable set to ASCII-8BIT.

I have also tried exporting the system locales from the Jenkins shell prior to the script's execution.

I am in need of some answer, or some direction that can help me resolve this issue.

0

The issue was resolved by updating all Ruby gems on the Jenkins system. It is likely that certain gems were out of date even though they were technically compatible with the version of Ruby the Jenkins machine was running, and therefor, there could have existed Ruby code that was non-UTF8.

If you run into this issue in the future, I would recommend ensuring that all gem and ruby versions are consistent between your Jenkins machine and the working machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.