1

** Laravel 4 beta 3 的问题:

字符串在第一个重音字符后停止显示。**

我有一个数据库表,用于存储 DVD 条目(标题、导演、...)

数据库是utf_8,标题的排序规则是utf8_unicode_ci

database.php 配置文件表明utf8_unicode_ci ......在模型中(扩展 Eloquent):

class Dvdentry extends Eloquent {
public $table = 'dvd_entry';
public $timestamps = false;
}

......... 在控制器中:

  $entries=Dvdentry::where($field,'like',$ulike)->get();

........ 在视图中:

 @foreach($entries as $entry)
    <a href={{$entry->imdb_link}} page=_blank>{{$entry->title}}</a>

.... 那应该显示一个标题列表。对于其中有重音的标题(即 Mépris (Le) ),只有 M 是

显示。我试过没有成功:

 {{{$entry->title}}}
 <?php echo $entry->title; ?>
 <?php echo utf_decode($entry->title); ?>

......任何线索。谢谢帮助。

4

1 回答 1

0

您是否尝试过 e() 助手?

e() - 在给定的字符串上运行 htmlentites,支持 UTF-8。

$entities = e('<html>foo</html>');

此时检查 Laravel 文档:http: //laravel.com/docs/helpers#strings

我还推测重音会导致 Blade 失败。在保存到数据库之前尝试对标题进行编码。所以重音被编码在 HTML 实体中......

Mépris => M&eacute;pris
于 2013-07-06T14:45:57.533 回答