js 文件上的链轮编码错误:无效的 UTF-8 字节序列 [英] Sprockets encoding error on js file: invalid UTF-8 byte sequence
问题描述
当我包含包含有效 utf-8 字符的文件时,会引发 Sprockets::EncodingError 异常.
A Sprockets::EncodingError exception is thrown when I include a file with characters that are valid utf-8.
有问题的行是:
* Copyright (c) 2010 - 2011 Johan Säll Larsson
如果我替换 ä 字符,问题就会消失,但我不想每次更新时都要记住编辑这个供应商文件.
If I replace the ä character, the problem goes away, but I don't want to have to remember to edit this vendor file everytime I update it.
我该如何解决这个问题?
How can I fix this?
推荐答案
我通过 这个链轮问题:
我只是将文件保存为 utf-8,(当您选择另存为"时,TextMate 可以选择执行此操作),问题就解决了.
I simply saved the file as utf-8, (TextMate has an option to do this when you chose 'Save As'), and the problem went away.
评论者@shedd 还创建了一个有用的耙任务来查找未正确编码的资产.
The commenter @shedd also created a useful rake task to find assets which are not encoded properly.
这篇关于js 文件上的链轮编码错误:无效的 UTF-8 字节序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!