我有一个预压缩的.gz
文件,我想在视图中呈现。
首先,我的配置设置为config.serve_static_files = true
,因此我们不需要像前面的nginx那样为视图提供服务。
基本上我的问题在于尝试渲染文件时出现
render file: '/public/assets/bomb-html-char-X-1G.html.gz'
我得到的错误如下:
ActionView::Template::Error (Your template was not saved as valid UTF-8. Please either specify UTF-8 as the encoding for your template in your text editor, or mark the template with its encoding by inserting the following as the first line of the template:
# encoding: <name of correct encoding>.
The source of your template was:
��@��Mk�@�s�+�=�mœ�
Yw�Z7��q�ݠI$�*�{��C�y|�2����/�d�����,�6�z�ϒ����,OᰎU�|��0�]]��\�N�
�6e�}���2��Pu���z��_�<�:�u����M�w�Cq���}o./߾
��H�X�q���_�}���U¾�<=�c_öy�/VOV���<$����S�T�/�C=�������u;��s
如果我用irb读取文件并检查编码我得到:
=> #<Encoding:UTF-8>
如果有人想看一下这个文件,可以在这里找到:
double comppressed version of the html.gz file
instructions and password for unpacking
注意:这是一个HTML解压缩炸弹(但我认为这不会影响它)