diff options
author | elijah <elijah@riseup.net> | 2013-05-08 00:15:18 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-05-08 00:15:18 -0700 |
commit | 115f471d6244fcaf4f68e99d729ef10c72289ccb (patch) | |
tree | 1b3bfdf9ad0746a8e8ba7ee8c295dc0d3f22846b /lib | |
parent | a84e7088454754205f9631e216065e28a51a4ba4 (diff) | |
download | leap_cli-115f471d6244fcaf4f68e99d729ef10c72289ccb.tar.gz leap_cli-115f471d6244fcaf4f68e99d729ef10c72289ccb.tar.bz2 |
attempt to fix file loading problem when the OS has a weird default encoding.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/config/manager.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb index f5282c5..0d14541 100644 --- a/lib/leap_cli/config/manager.rb +++ b/lib/leap_cli/config/manager.rb @@ -185,11 +185,13 @@ module LeapCli log :loading, filename, 2 # - # read file, strip out comments - # (File.read(filename) would be faster, but we like ability to have comments) + # Read a JSON file, strip out comments. + # + # UTF8 is the default encoding for JSON, but others are allowed: + # https://www.ietf.org/rfc/rfc4627.txt # buffer = StringIO.new - File.open(filename) do |f| + File.open(filename, "rb") do |f| while (line = f.gets) next if line =~ /^\s*\/\// buffer << line |