解决 ruby vpim 中的 'invalid multibyte escape: /^þÿ/'
问题:
在 Ruby 2.0/2.1 中使用 vpim gem(在版本 0.695 上测试)时,你收到类似这样的错误消息:
ruby_vpim_error.txt
/usr/local/rvm/gems/ruby-2.1.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': /usr/local/rvm/gems/ruby-2.1.0/gems/vpim-0.695/lib/vpim/vcard.rb:678: invalid multibyte escape: /^\xFE\xFF/ (SyntaxError)解决方案
编辑错误消息中列出的 vcard.rb 文件(你需要编辑确切列出的文件,而不是任何 vcard.rb!)。
在前面添加以下行 — 它必须是文件中的第一行:
fix_encoding.rb
# encoding: US-ASCII就这样!
有了这行,你强制 Ruby 不将转义字符解释为 UTF-8 字符序列。
Check out similar posts by category:
Allgemein
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow