_Issue moved from https://github.com/google/flutter-desktop-embedding/issues/586#event-2689960105_
I got this error when I was trying to launch macOS from VSCode:
Launching lib/main.dart on macOS in debug mode...
CocoaPods' output:
โณ
Preparing
Analyzing dependencies
Inspecting targets to integrate
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
โโโ MARKDOWN TEMPLATE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
### Command
```
/usr/local/Cellar/cocoapods/1.8.1/libexec/bin/pod install --verbose
...
ArgumentError - invalid byte sequence in US-ASCII
...
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=invalid+byte+sequence+in+US-ASCII&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- Pod Install failed
https://github.com/CocoaPods/CocoaPods/issues/9222 [open] [1 comment]
14 hours ago
- Error while setting up CocoaPods
https://github.com/CocoaPods/CocoaPods/issues/5979 [closed] [23 comments]
06 Dec 2018
- invalid byte sequence in US-ASCII
https://github.com/CocoaPods/CocoaPods/issues/1036 [closed] [9 comments]
08 Jun 2017
and 15 more at:
https://github.com/cocoapods/cocoapods/search?q=invalid%20byte%20sequence%20in%20US-ASCII&type=Issues&utf8=โ
Error output from CocoaPods:
โณ
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
I have export LANG=en_US.UTF-8 in my ~/.profile and have also configured VSCode as:
{
"dart.env": {
"LANG": "en-US.UTF-8",
}
}
However, directly launch from terminal works:
flutter run -d macOS
My other targets web, ios and android work from VSCode.
Are you launching this from the built-in terminal, or by using the Debug menu/F5? (it's not clear if the terminal it works from is the VS Code one, or external).
Could you also try it in the "other one" (so if you're using built-in terminal, try with F5 and vice-versa` and report the results? Eg.:
F5?Thanks!
@DanTup My other targets (iOS, Android, Web) work fine in both VSC F5 and built-in terminal and also my external terminal. Here are info for my macOS target:
F5: doesn't work, got the above errorflutter run -d macOS): works fineI am using macOS 10.14.6, VSC 1.38.1 and master channel of Flutter
Thanks for the info. In my testing dart.env is correctly set in the Flutter environment when we spawn it. Do you know a way I can reproduce this? Some of the related cocoapods issues suggest it may be related to non-ascii symbols in pod paths, do you know if that's the case here?
@DanTup It did look like it was the non-ascii symbol problem. Here is the detailed log:
Launching lib/main.dart on macOS in debug mode...
CocoaPods' output:
โณ
Preparing
Analyzing dependencies
Inspecting targets to integrate
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
โโโ MARKDOWN TEMPLATE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
### Command
```
/usr/local/Cellar/cocoapods/1.8.3/libexec/bin/pod install --verbose
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods : 1.8.3
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
RubyGems : 3.0.3
Host : Mac OS X 10.15 (19A583)
Xcode : 11.1 (11A1027)
Git : git version 2.21.0
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ eb1227f73f7bbd779c06744a97a8eabbbfeff757
trunk - CDN - https://cdn.cocoapods.org/
```
### Plugins
```
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0
```
### Podfile
```ruby
platform :osx, '10.11'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
def pubspec_supports_macos(file)
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return false;
end
File.foreach(file_abs_path) { |line|
return true if line =~ /^\s*macos:/
}
return false
end
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
ephemeral_dir = File.join('Flutter', 'ephemeral')
symlink_dir = File.join(ephemeral_dir, '.symlinks')
symlink_plugins_dir = File.join(symlink_dir, 'plugins')
system("rm -rf #{symlink_dir}")
system("mkdir -p #{symlink_plugins_dir}")
# Flutter Pods
generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig'))
if generated_xcconfig.empty?
puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcconfig.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join(symlink_dir, 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join(symlink_plugins_dir, p[:name])
File.symlink(p[:path], symlink)
if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml'))
pod p[:name], :path => File.join(symlink, 'macos')
end
}
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true
```
### Error
```
ArgumentError - invalid byte sequence in US-ASCII
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/config.rb:275:in `split'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/config.rb:275:in `hash_from_file_content'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/config.rb:257:in `extract_hash'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/config.rb:64:in `initialize'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/project/object/build_configuration.rb:216:in `new'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/project/object/build_configuration.rb:216:in `config'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/project/object/build_configuration.rb:90:in `resolve_build_setting'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/project/object/configuration_list.rb:78:in `block in get_setting'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/project/object/configuration_list.rb:77:in `each'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/project/object/configuration_list.rb:77:in `get_setting'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/xcodeproj-1.12.0/lib/xcodeproj/project/object/native_target.rb:55:in `resolved_build_setting'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer/target_inspector.rb:226:in `block in compute_swift_version_from_targets'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer/target_inspector.rb:220:in `each'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer/target_inspector.rb:220:in `inject'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer/target_inspector.rb:220:in `compute_swift_version_from_targets'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer/target_inspector.rb:45:in `compute_results'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:1101:in `block (3 levels) in inspect_targets_to_integrate'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:1099:in `each'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:1099:in `block (2 levels) in inspect_targets_to_integrate'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:1097:in `each'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:1097:in `block in inspect_targets_to_integrate'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/user_interface.rb:64:in `section'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:1092:in `inspect_targets_to_integrate'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:106:in `analyze'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:410:in `analyze'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:234:in `block in resolve_dependencies'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/user_interface.rb:64:in `section'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:156:in `install!'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/command/install.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.8.3/libexec/gems/cocoapods-1.8.3/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.8.3/libexec/bin/pod:23:in `load'
/usr/local/Cellar/cocoapods/1.8.3/libexec/bin/pod:23:in `<main>'
```
โโโ TEMPLATE END โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=invalid+byte+sequence+in+US-ASCII&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- Pod Install failed
https://github.com/CocoaPods/CocoaPods/issues/9222 [closed] [3 comments]
10 hours ago
- Error while setting up CocoaPods
https://github.com/CocoaPods/CocoaPods/issues/5979 [closed] [23 comments]
06 Dec 2018
- invalid byte sequence in US-ASCII
https://github.com/CocoaPods/CocoaPods/issues/1036 [closed] [9 comments]
08 Jun 2017
and 15 more at:
https://github.com/cocoapods/cocoapods/search?q=invalid%20byte%20sequence%20in%20US-ASCII&type=Issues&utf8=โ
Error output from CocoaPods:
โณ
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
Error running pod install
Exited (sigterm)
@guiguan I'm not sure where the non-ascii symbol is - do you know what I need to do to reproduce this?
@DanTup okay, you can follow these steps to reproduce this:
flutter on master channelflutter macOS embedding: flutter config --enable-macos-desktopmkdir ~/Downloads/myprojcd ~/Downloads/myproj && flutter create --macos --project-name proj --org com.proj .flutter extensionTry to add a pub package that makes use of cocoapods:
Add file_chooser in pubspec.yaml:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
file_chooser:
git:
url: https://github.com/google/flutter-desktop-embedding.git
path: plugins/file_chooser
Add this in main.dart:
import 'package:file_chooser/file_chooser.dart';
void main() {
if (false) {
// try to use `file_chooser`
showOpenPanel;
}
_enablePlatformOverrideForDesktop();
runApp(MyApp());
}
Now, in VSCode press F5 to debug the project in macOS target
I followed those steps using current master, but it launched fine without any errors:

I tried removing the if (false) to ensure that code wasn't being removed, but it still works (though the call to showOpenPanel fails at runtime).
In my console, I don't have any output starting "CocoaPods' output:" at all. Do you know where the non-Ascii character it's complaining might be? Do you have non-ascii characters in any of your paths?
Should my project have a Podfile? If I run pod update in the folder, it says NoPodfile' found in the project directory.`. Do I need one?
Edit: Readme suggests Flutter manages that.
@DanTup hmm, strange. There is a Podfile under my macos folder.

Anyway, I uploaded my test project to here: https://github.com/guiguan/debugproj Give it a try and see if you get the same error
That also works fine here.
If I make a new build of Dart-Code that dumps all of the environment variables to the log, could you try that out? It'd be interesting to compare the env variables we have when launching Flutter versus what you see when you type printenv in the terminal where it works.
@DanTup sure
Ok, there's a build here:
https://github.com/Dart-Code/Dart-Code/releases/tag/v3.6.0-alpha.3
You install it by downloading the vsix and running Extension: Install from VSIX in VS Code (see https://dartcode.org/docs/installing-a-preview-release/).
It'll probably prompt you to reload - do so, then run the Dart: Capture Logs command (leave everything ticked) and then reproduce the issue and then click Cancel on the logging dialog.
Search the log for Full environment is and find the one that occurs right after it says it's spawning flutter run. That will have all of the env variables set for the Code process (and just before it the line that says .. with are the additional env variables we're adding).
It'd be interesting to see if there's anything unusual in there, or that differs from running printenv in the terminal.
@DanTup this is my env vars for Dart-Code following your steps:
{
"USER": "guiguan",
"DISPLAY": "/private/tmp/com.apple.launchd.mWWzvrxIQm/org.macosforge.xquartz:0",
"LOGNAME": "guiguan",
"PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin",
"SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.h0TmmpfHDJ/Listeners",
"HOME": "/Users/guiguan",
"SHELL": "/bin/bash",
"__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
"TMPDIR": "/var/folders/lx/6rpwbgm97zvb170pqvqxrjjc0000gn/T/",
"XPC_SERVICE_NAME": "com.microsoft.VSCode.7044",
"XPC_FLAGS": "0x0",
"VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
"VSCODE_NODE_CACHED_DATA_DIR": "/Users/guiguan/Library/Application Support/Code/CachedData/88f15d17dca836346e787762685a40bb5cce75a8",
"VSCODE_LOGS": "/Users/guiguan/Library/Application Support/Code/logs/20191015T202635",
"VSCODE_IPC_HOOK": "/Users/guiguan/Library/Application Support/Code/1.39.1-main.sock",
"VSCODE_PID": "66127",
"PWD": "/",
"SHLVL": "1",
"_": "/Applications/Visual Studio Code.app/Contents/MacOS/Electron",
"AMD_ENTRYPOINT": "vs/workbench/services/extensions/node/extensionHostProcess",
"PIPE_LOGGING": "true",
"VERBOSE_LOGGING": "true",
"VSCODE_IPC_HOOK_EXTHOST": "/var/folders/lx/6rpwbgm97zvb170pqvqxrjjc0000gn/T/vscode-ipc-eb4d382a-7851-4286-9e16-e4fd8f7876e7.sock",
"VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
"VSCODE_LOG_STACK": "false",
"ELECTRON_RUN_AS_NODE": "1",
"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "true"
}
this is my env vars for VSCode built-in terminal (printenv):
USER=guiguan
DISPLAY=/private/tmp/com.apple.launchd.mWWzvrxIQm/org.macosforge.xquartz:0
LOGNAME=guiguan
PATH=/Users/guiguan/Toolkits/google-cloud-sdk/bin:/Users/guiguan/.nvm/versions/node/v11.4.0/bin:/Users/guiguan/Toolkits:/Users/guiguan/Documents/Projects/gcloud/istio-1.0.0/bin:/Users/guiguan/Toolkits/pear/bin:/usr/local/opt/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Applications/Muse:/Users/guiguan/.cargo/bin:/Users/guiguan/Documents/Projects/go/bin:/Users/guiguan/Documents/Projects/flutter/bin:/Users/guiguan/Documents/Projects/flutter/.pub-cache/bin:/Users/guiguan/Documents/Projects/flutter/bin/cache/dart-sdk/bin
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.h0TmmpfHDJ/Listeners
HOME=/Users/guiguan
SHELL=/bin/bash
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
TMPDIR=/var/folders/lx/6rpwbgm97zvb170pqvqxrjjc0000gn/T/
XPC_SERVICE_NAME=0
XPC_FLAGS=0x0
PWD=/Users/guiguan/Downloads/myproj
SHLVL=2
TERM_PROGRAM=vscode
TERM_PROGRAM_VERSION=1.39.1
LANG=en_US.UTF-8
COLORTERM=truecolor
TERM=xterm-256color
OLDPWD=/Users/guiguan/Downloads/myproj
PYTHONSTARTUP=/Users/guiguan/.pystartup
SVN_EDITOR=code -w
EDITOR=code -w
SDKMANAGER_OPTS=--add-modules java.se.ee
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
TZ=Australia/Melbourne
NVM_DIR=/Users/guiguan/.nvm
NVM_CD_FLAGS=-q
MANPATH=/Users/guiguan/.nvm/versions/node/v11.4.0/share/man:/usr/local/opt/erlang/lib/erlang/man
NVM_BIN=/Users/guiguan/.nvm/versions/node/v11.4.0/bin
MAVEN_OPTS=-Xms512m -Xmx2048m
ATOM_REPOS_HOME=/Users/guiguan/Documents/Projects
GOPATH=/Users/guiguan/Documents/Projects/go
GOM=/Users/guiguan/Documents/Projects/go-master/bin/go
DEPM=/Users/guiguan/Documents/Projects/go/bin/dep
ZSH=/Users/guiguan/.oh-my-zsh
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
P9K_SSH=0
_=/usr/bin/printenv
It looks like the Dart-Code was not spawning a login shell, and also my following VSCode config:
"dart.env": {
"LANG": "en-US.UTF-8",
},
was not applied in the Dart-Code env.
@guiguan it's expected that it wouldn't spawn a login shell. The dart.env setting won't appear in the new line of logging (that is just the environment Code has), but is there a line above it in the log that contains ".. with" and includes it?
@DanTup
[8:34:09 PM] [FlutterRun] [Info] Spawning /Users/guiguan/Documents/Projects/flutter/bin/flutter with args ["run","--machine","--target","lib/main.dart","-d","macOS","--track-widget-creation","--start-paused","-v"]
[8:34:09 PM] [FlutterRun] [Info] .. in /Users/guiguan/Downloads/myproj
[8:34:09 PM] [FlutterRun] [Info] Full environment is {"USER":"guiguan","DISPLAY":"/private/tmp/com.apple.launchd.mWWzvrxIQm/org.macosforge.xquartz:0","LOGNAME":"guiguan","PATH":"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.h0TmmpfHDJ/Listeners","HOME":"/Users/guiguan","SHELL":"/bin/bash","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","TMPDIR":"/var/folders/lx/6rpwbgm97zvb170pqvqxrjjc0000gn/T/","XPC_SERVICE_NAME":"com.microsoft.VSCode.7044","XPC_FLAGS":"0x0","VSCODE_NLS_CONFIG":"{\"locale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_NODE_CACHED_DATA_DIR":"/Users/guiguan/Library/Application Support/Code/CachedData/88f15d17dca836346e787762685a40bb5cce75a8","VSCODE_LOGS":"/Users/guiguan/Library/Application Support/Code/logs/20191015T202635","VSCODE_IPC_HOOK":"/Users/guiguan/Library/Application Support/Code/1.39.1-main.sock","VSCODE_PID":"66127","PWD":"/","SHLVL":"1","_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","AMD_ENTRYPOINT":"vs/workbench/services/extensions/node/extensionHostProcess","PIPE_LOGGING":"true","VERBOSE_LOGGING":"true","VSCODE_IPC_HOOK_EXTHOST":"/var/folders/lx/6rpwbgm97zvb170pqvqxrjjc0000gn/T/vscode-ipc-eb4d382a-7851-4286-9e16-e4fd8f7876e7.sock","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_LOG_STACK":"false","ELECTRON_RUN_AS_NODE":"1","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"true"}
@guiguan Oh, that definitely looks like the env variable isn't making it then. It seemed to come through for me - I'll do some more testing and if I can't figure it out, I might make another build with some additional logging.
Out of interest - do you have a launch.json? If so, what does it look like?
And where is your dart.env defined?
@DanTup
I might make another build with some additional logging
Sure. Happy to help
do you have a launch.json?
Na, don't have one in the testing project
And where is your dart.env defined?
It's defined in Preferences: Open Settings (JSON) (root level)
Thanks! It turns out, the logging was slightly different to how I remembered... The dart.env variable is stitched on in the spawn function which is after the logging. I've made a new build here:
https://github.com/Dart-Code/Dart-Code/releases/tag/v3.6.0-alpha.4
This will log the overriden env variables when it spawns process. They'll show up in the Chrome dev tools console so you don't need to mess with logging (click Help -> Toggle Developer Tools in VS Code to open the Chrome dev tools, then click the console tab). They'll look like this:

If LANG shows up there, then it's definitely being set when we spawn the process. We do set shell: true when spawning processes - I don't know the impact of that (eg. whether it runs any shell scripts), but since flutter is a shell script, I presume it's going to start a shell even without it.
@DanTup yes, it looks like the env is properly set. Probably, it somehow didn't pass the env to the underlying cocoapods process?

I'm not sure how Flutter spawns Cocoapods, but if it wasn't passing this on, I would expect the same to occur from the terminal too ๐ค
I found some similar complaints in their issue tracker, including this:
https://github.com/CocoaPods/CocoaPods/issues/639#issuecomment-11483748
Does setting LC_ALL="en_US.UTF-8" make any difference?
Also, there's a not here saying it might be a Ruby version issue:
https://github.com/CocoaPods/CocoaPods/issues/2385#issuecomment-52040591
Upgrading Ruby to v2 fixed it for that user. Do you know what you have?
If none of those help, it may be worth opening an issue in CocoaPods asking for some help on how to track down the issue.
@DanTup setting the LC_ALL="en_US.UTF-8" in VSCode config works. Wow!
Weird - that's not set in your other env, so I'm not sure what's going on. There have been some issues in Flutter that are related to locale, like
I don't really understand what's happening, but I'll close this as there's a fix for now. If others reading are seeing this too, please comment here - if it's affecting a lot of people then we might want to dig deeper.
Hello, I am also getting the error that @guiguan originally described.
ArgumentError - invalid byte sequence in US-ASCII
... bunch of Ruby messages removed ...
Error output from CocoaPods:
โณ
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
Following along, I made sure that my locale was set for my login:
$ locale
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 I added the following to my VS Code settings.json file:
"dart.env": {
"LC_ALL": "en_US:UTF-8",
"LANG": "en_US.UTF-8"
}
However, I am still seeing the same error. Here's my environment.
Version: 1.39.2
Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390
Date: 2019-10-15T15:33:00.827Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0
Dart: 3.5.1
Flutter: 3.5.1
Am I misunderstanding what I should add to settings.json or am I supposed to add the LC_ALL to a different settings file?
Thanks in advance for your help,
Mark.
Never mind. It's amazing how many times you can look at something and not see the error until after you post it! Anyway, once I fixed the entry for LC_ALL in my VS Code settings.json file, then the error went away for me too.
For reference, here's the entry in my settings.json file that is working:
"dart.env": {
"LC_ALL": "en_US.UTF-8",
"LANG": "en_US.UTF-8"
}
Thank you @DanTup for your help with this. I am sorry for the noise.
No worries - glad you got it sorted. I still don't fully understand what's going on here, but if it keeps coming up I'll try and do some more digging to better understand - it seems like there must be a bug somewhere (VS Code? Flutter?) for this to work in the terminal but not when the extension host spawns it, but I don't understand what (given all the env vars above were the same).
For anyone else coming across this thread, please do post if you're hitting this and any info that might be relevant!
I'm seeing this on my Mac now, so was able to do some more debugging. Here's my understanding of the issue:
LANG etc.) because it affects how it reads filesLANG env var is set by the terminal at startup - it is not set system-wide for programs not launched from the terminalLANG set, that results in us spawning flutter run without it set, and that results in CocoaPods/Ruby using ansii encoding and breaking on UTF-8The ideal fix would be "Dart-Code should just set UTF8" on all its processes - however LANG requires both a language part and encoding, so if LANG isn't already set, we don't know what to set this to. In VS Code it seems that Intl.DateTimeFormat().resolvedOptions().locale returns the correct thing for the main process, however it's incorrect in the extension host.
I've opened https://github.com/microsoft/vscode/issues/85675 to see if this can be fixed. Using dart.env is still the current workaround, but I think if VS Code can expose the system language to us, we could set this explicitly to avoid the need for that.
This has been fixed in Flutter now - it'll force LANG to get set when spawning CocoaPods:
https://github.com/flutter/flutter/pull/45710
Once you're on a version that includes that change, you won't need to force this in dart.env or profile scripts.
Most helpful comment
Never mind. It's amazing how many times you can look at something and not see the error until after you post it! Anyway, once I fixed the entry for LC_ALL in my VS Code settings.json file, then the error went away for me too.
For reference, here's the entry in my settings.json file that is working:
Thank you @DanTup for your help with this. I am sorry for the noise.