Skip to content

GDK-in-a-box: Add LOCALE env vars to GDK-in-a-box container image

What does this merge request do and why?

This merge request fixes locale encoding issues in the GDK-in-a-box Docker container that cause failures when processing UTF-8 characters (emojis, international characters) in various tools like Danger, Git, and Ruby applications, see #2035 (comment 2785270169) .

The container was generating UTF-8 locales but not setting them as the default, causing processes to fall back to the ASCII-only POSIX locale. This resulted in encoding errors when tools encountered non-ASCII characters, particularly in commit messages and JSON parsing.

🛠️ with ❤️ at Siemens

How to set up and validate locally

  1. Build the updated Docker image with the locale fix:

    docker build -t gdk-in-a-box:locale-fix -f support/gdk-in-a-box/Dockerfile .
  2. Run a container from the new image:

    docker run -it gdk-in-a-box:locale-fix /bin/bash
  3. Verify the locale is correctly set to UTF-8:

    locale
    # Should show LANG=en_US.UTF-8 and LC_ALL=en_US.UTF-8
    
    locale charmap
    # Should show UTF-8, not ANSI_X3.4-1968 or ASCII
  4. Test UTF-8 handling with a practical example:

    # Create a file with emoji
    echo "Test 🚀" > test.txt
    cat test.txt
    
    # Test with Ruby
    ruby -e "puts '🤖 UTF-8 works!'"
    
    # Test with Git commit containing emoji
    git init test-repo && cd test-repo
    echo "test" > file.txt
    git add file.txt
    git commit -m "Initial commit 🎉"
  5. Run Danger to ensure it can parse emoji without errors:

    bundle exec danger dry_run
    # Should complete without "Invalid byte sequence" errors

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This MR references an issue describing the change.
  • 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.

Related to #2035

Edited by Gerardo Navarro

Merge request reports

Loading