Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Encoding issue when using gem 'xcodeproj' #43

Closed
@idomizrachi

Description

@idomizrachi

Environment

  • 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 = Xcodeproj::Project.open("/Users/ido/projects/sample/sample.xcodeproj")

Notes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions