首页 > 解决方案 > Unicode 规范化不适用于 ASCII-8BIT

问题描述

13: from /usr/local/bin/pod:23:in `<main>'
12: from /usr/local/bin/pod:23:in `load'
11: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/bin/pod:55:in `<top (required)>'
10: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/command.rb:52:in `run'
9: from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
8: from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
7: from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
6: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/command.rb:66:in `report_error'
5: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/user_interface/error_report.rb:30:in `report'
4: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
3: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/config.rb:226:in `podfile_path'
2: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/config.rb:166:in `installation_root'
1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)

我面临这些错误,不知道为什么当我运行 pod update 时它会给我这个错误。有什么解决办法??

标签: iosflutterdart

解决方案


这个问题出现在 Cocoapods 1.11.0 中,许多人已经注意到回滚到 1.10.2 解决了这个问题。但最初的问题来自终端中设置的错误区域设置。它必须是基于 UTF-8 的语言环境。

您可以在终端中运行“语言环境”来检查当前的语言环境设置。它应该是这样的:

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=

If you have ascii-based locales set or "C" (which is also an ascii locale) then run

export LC_ALL=en_US.UTF-8

If you prefer some other locale (not en_US) then run locale -a to see the list of available options and pick UTF-8 locale you prefer.

Actually CocoaPods warns that UTF-8 locale is required:

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

    export LANG=en_US.UTF-8

But before 1.11.0 it was required only in case you use pods which contain non-ascii symbols in their names (Chinese for example) but starting 1.11.0 it become more strict. There is a discussion on Cocoapods GitHub about it: https://github.com/CocoaPods/CocoaPods/issues/10939


推荐阅读