Skip to content

Fix incompatible character encodings: UTF-8 and ASCII-8BIT

Nao Hashizume requested to merge 2095-fix-incompatible-encoding-error into main

What does this merge request do and why?

This MR fixes a compatibility error by ensuring that the output is always encoded in UTF-8. The error occurs when running the setup_workspace.rb in Remote development GDK workspace. The script fails before asking the user to allow sending telemetry. During investigation, I found that the output for print/puts methods could be nil, not a string, or not UTF-8 encoded. Here's the error stack:

/projects/gitlab-development-kit/lib/gdk/output.rb:96:in `+': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
        from /projects/gitlab-development-kit/lib/gdk/output.rb:96:in `debug'
        from /projects/gitlab-development-kit/lib/shellout.rb:38:in `execute'
        from support/gitlab-remote-development/setup_workspace.rb:43:in `execute_bootstrap'
        from support/gitlab-remote-development/setup_workspace.rb:18:in `run'
        from support/gitlab-remote-development/setup_workspace.rb:71:in `<main>'

Closes #2095 (closed)

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Nao Hashizume

Merge request reports