You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter iOS运行报错:Unicode Normalization not appropriate for ASCII-8BIT

Flutter iOS运行时触发CocoaPods编码错误求助

在iOS上运行Flutter应用时触发以下CocoaPods错误,应用可正常构建,仅运行时出错:

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
        
    /usr/local/Cellar/ruby/3.2.2/lib/ruby/3.2.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:166:in `unicode_normalize'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:166:in `installation_root'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:226:in `podfile_path'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface/error_report.rb:30:in `report'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:66:in `report_error'
        from /usr/local/lib/ruby/gems/3.2.0/gems/claide-1.1.0/lib/claide/command.rb:396:in `handle_exception'
        from /usr/local/lib/ruby/gems/3.2.0/gems/claide-1.1.0/lib/claide/command.rb:337:in `rescue in run'
        from /usr/local/lib/ruby/gems/3.2.0/gems/claide-1.1.0/lib/claide/command.rb:324:in `run'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/bin/pod:55:in `<top (required)>'
        from /usr/local/bin/pod:25:in `load'
        from /usr/local/bin/pod:25:in `<main>'
    /usr/local/Cellar/ruby/3.2.2/lib/ruby/3.2.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:166:in `unicode_normalize'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:166:in `installation_root'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:226:in `podfile_path'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:205:in `podfile'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/command/install.rb:46:in `run'
        from /usr/local/lib/ruby/gems/3.2.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
        from /usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.12.1/bin/pod:55:in `<top (required)>'
        from /usr/local/bin/pod:25:in `load'
        from /usr/local/bin/pod:25:in `<main>'

已在~/.profile和~/.zshrc中添加export LANG=en_US.UTF-8,执行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"

在iOS目录执行pod install可正常完成,但运行Flutter应用时仍触发上述错误。

已完成以下排查步骤,排除常见问题:

  • Podfile中已添加source 'https://cdn.cocoapods.org/'
  • 可正常执行pod install无异常
  • locale命令显示Unicode编码配置正确
  • 已在~/.profile和~/.zshrc中配置正确的Unicode编码
  • which ruby命令指向/usr/local/opt/ruby/bin/ruby,路径正常
  • 已完全重装CocoaPods,但问题仍未解决

恳请提供有效的解决方案。

内容的提问来源于stack exchange,提问作者Muhammed Refaat

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 18:01:59