我使用 Laravel 显示 Google 图表,但不幸的是,带有重音字符的标题显示不正确
@foreach($barcs as $barc)
[ '{{$barc->titre}}', {{$barc->nbr}}],
@endforeach
最佳答案
传递给图表 API 的所有显示文本都必须先进行 UTF-8 编码,然后再进行 URL 编码。尝试像这样输出您的标题:
@foreach($barcs as $barc)
[ '{{htmlentities($barc->titre, ENT_QUOTES, "UTF-8")}}', {{$barc->nbr}}],
@endforeach
这会将重音字符转换为 Google Charts 可以处理的字符。
someèthing with añ accent
作为 someèthing with añ 发送给 Google口音
如果这不起作用,您能告诉我们您没有正确显示的重音字符是什么吗?
关于php - 谷歌在laravel中绘制标题中的字符重音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42325173/