Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding issue when using gem 'xcodeproj' #43

idomizrachi opened this Issue Aug 7, 2016 · 2 comments


None yet
3 participants
Copy link

idomizrachi commented Aug 7, 2016


  • vscode-ruby version: 0.5.2
  • Ruby version: 2.3.0p0 (revision 53290)
  • VS Code version: 1.4.0
  • Operating System: OS X El Captian (10.11.5)

Verified ruby, ruby-debug-ide and ruby-debug-basex19 installed

Expected behavior

Should be able to run ruby scripts that use the gem 'xcodeproj' using VS Code

Actual behavior

When executing the script from visual studio code using ruby extension I get the following error:

Uncaught exception: invalid byte sequence in US-ASCII
    /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/plist.rb:86:in `match'
    /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/plist.rb:86:in `match'
    /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/plist.rb:86:in `file_in_conflict?'
    /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/plist.rb:19:in `read_from_path'
    /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/project.rb:200:in `initialize_from_file'
    /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/project.rb:102:in `open'
    /Users/XXXXXX/script.rb:4:in `<top (required)>'
    /usr/local/bin/rdebug-ide:23:in `load'
    /usr/local/bin/rdebug-ide:23:in `<main>'
/usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/plist.rb:86:in `match': invalid byte sequence in US-ASCII (ArgumentError)
    from /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/plist.rb:86:in `match'
    from /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/plist.rb:86:in `file_in_conflict?'
    from /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/plist.rb:19:in `read_from_path'
    from /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/project.rb:200:in `initialize_from_file'
    from /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj/project.rb:102:in `open'
    from /Users/XXXXXXX/script.rb:4:in `<top (required)>'
    from /usr/local/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:88:in `debug_load'
    from /usr/local/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:88:in `debug_program'

Steps to reproduce the problem

A ruby script that use 'xcodeproj' gem:

#!/usr/bin/env ruby
require 'xcodeproj'
project ="/Users/ido/projects/sample/sample.xcodeproj")


I had a similar issue on a jenkins slave and managed to solve it by running the following commands before running the ruby script:

export LANG=en_US.UTF-8
export LC_COLLATE=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_MESSAGES=en_US.UTF-8
export LC_MONETARY=en_US.UTF-8
export LC_NUMERIC=en_US.UTF-8
export LC_TIME=en_US.UTF-8
export LC_ALL=en_US.UTF-8

I didn't find any way to set the environment variable in VS Code before executing the ruby script


This comment has been minimized.

Copy link

uwishdoggy commented Aug 11, 2016



This comment has been minimized.

Copy link

HookyQR commented Aug 25, 2016

Set up your launch configuration like so:

      "name": "Debug Local File with env settings",
      "type": "Ruby",
      "request": "launch",
      "program": "${workspaceRoot}/script.rb",
      "env": {
            "LANG": "en_US.UTF-8",
            "LC_COLLATE": "en_US.UTF-8",
            "LC_CTYPE": "en_US.UTF-8",
            "LC_MESSAGES": "en_US.UTF-8",
            "LC_MONETARY": "en_US.UTF-8",
            "LC_NUMERIC": "en_US.UTF-8",
            "LC_TIME": "en_US.UTF-8",
            "LC_ALL": "en_US.UTF-8"

And everything will be all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.