简体   繁体   English

在VSCode终端中更新UTF

[英]Updating UTF in VSCode Terminal

Problem 问题

There is an error when launching a flutter application in VSCode. 在VSCode中启动Flutter应用程序时出错。 It require the LANG setting to be en_US.UTF-8 它要求LANG设置为en_US.UTF-8

Already Tried 已经尝试过

The issue and warning can be found here: https://github.com/NativeScript/NativeScript/issues/3659 可以在这里找到问题和警告: https : //github.com/NativeScript/NativeScript/issues/3659

I've followed the advice I found there and added export LANG=en_US.UTF-8 in my .bash_profile (mac) which has updated VSCode's UTF as well. 我遵循了在那里找到的建议,并在我的.bash_profile (mac)中添加了export LANG=en_US.UTF-8 ,它也更新了VSCode的UTF。

Error Message(s) 错误讯息

However, when I re-run, I receive the same warning(s): 但是,当我重新运行时,会收到相同的警告:

 WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
        Consider adding the following to ~/.profile:
        export LANG=en_US.UTF-8

Where can I find the ~/.profile file to update it as well? 在哪里可以找到~/.profile文件进行更新?

The problem here is likely that where you've set the environment variable doesn't apply to VS Code based on how you ran it. 这里的问题可能是,根据环境变量的设置,您在其中设置环境变量的位置不适用于VS Code。 For example if you set an env variable in .profile but then launch VS Code from the iOS dock, it might not inherit that value. 例如,如果您在.profile设置了一个env变量,然后从iOS Dock启动VS Code,则它可能不会继承该值。

To confuse things, when you use the built-in Terminal in VS Code, it will cause your bash startup scripts to run, which meants the built-in terminal makes it seem like the variable is set (but it's actually only set for the terminal, and not for commands that VS Code extensions spawn). 令人困惑的是,当您在VS Code中使用内置终端时,它将导致您的bash启动脚本运行,这意味着内置终端使其看起来像已设置了变量(但实际上仅是为终端设置了) ,不适用于VS Code扩展名产生的命令)。

There are two possible fixes: 有两个可能的修复:

  1. Set the environment variable somewhere that it is applied system-wide (this may be tricky depending on your OS) 将环境变量设置为在系统范围内应用的某个位置(根据您的操作系统,这可能很棘手)
  2. Set it in dart.env in your VS Code user settings: 在VS Code用户设置的dart.env中进行设置:
     "dart.env": { "LANG": "en_US.UTF-8" }, 
    This should apply it to any Flutter processes spawned by the Flutter extension and prevent the warning. 这应该将其应用于Flutter扩展产生的任何Flutter进程,并防止出现警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 vsCode 中运行 dart 终端 - Running dart terminal in vsCode 无法在 vscode 终端中创建项目 - Unable to create project in vscode terminal 为什么我可以在 linux 终端中运行 flutter 命令,但不能在 vscode 终端中运行? - Why i can run flutter command in linux terminal, but not in vscode terminal? CocoaPods 要求您的终端使用 UTF-8 编码 - CocoaPods requires your terminal to be using UTF-8 encoding CocoaPods 要求您的终端使用 UTF-8 编码。 考虑将以下内容添加到 ~/.profile:export LANG=en_US.UTF-8 - CocoaPods requires your terminal to be using UTF-8 encoding. Consider adding the following to ~/.profile: export LANG=en_US.UTF-8 CocoaPods 要求您的终端使用 UTF-8 编码。 考虑将以下内容添加到 ~/.profile。 导出 LANG=en_US.UTF-8 - CocoaPods requires your terminal to be using UTF-8 encoding. Consider adding the following to ~/.profile. export LANG=en_US.UTF-8 flutter 应用程序不从 VsCode 运行,但它从终端运行良好 - flutter app doesn't run from VsCode, but it runs fine from terminal 如何使 bash 终端从 VSCode 运行,使用为项目选择的 Flutter 版本 - How to make bash terminal ran from VSCode use Flutter version selected for the project iOS - CocoaPods 要求您的终端使用 UTF-8 编码 - 在最新的 flutter 升级之后 - iOS - CocoaPods requires your terminal to be using UTF-8 encoding - after latest flutter upgrade VScode 配置 - VScode Configuration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM