Ruby on Rails-编码问题 [英] Ruby on Rails - encoding issue

查看:87
本文介绍了Ruby on Rails-编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个RoR应用程序,该应用程序从使用utf8_general_ci作为排序规则的某些事件表中提取数据。

I am running a RoR app that pulls data from some event tables which are using utf8_general_ci as collation.

问题是我的所有页面都呈现如下内容:

The problem is that all my pages render stuff like this:

Atatrk体育场Stadi Nov 02 20:00

Atat�rk Stadi Nov 02 20:00

到目前为止,我已经尝试过:
-更改application中的编码。rb

So far I have tried: - changing the encoding within application.rb


  • 添加

  • adding

<meta charset="utf-8" />


  • 添加

  • adding

    content="text/html;charset=utf-8"
    


  • 以上标记的所有组合以及可能适用于我们内容的所有可能的相关编码。

  • all combinations of above tags with all possible relevant encodings that may apply to our content.

    文档类型为

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    

    我也尝试过HTML5和其他变化。

    I have also tried HTML5 and other variations.

    我还没有尝试过iconv解决方案,宁愿不必走那条路。

    I have not yet tried the iconv solution, would prefer not having to go down that road.

    有有人对如何解决这个问题有任何想法吗?

    Does anyone have any idea on how to resolve this?

    谢谢!
    N。

    Thank you! N.

    推荐答案

    您是否有编码:config / database.yml文件中为utf8?

    do you have a encoding: utf8 in your config/database.yml file?

    这篇关于Ruby on Rails-编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆