[英]Sweet Alerts is display UTF-8 Chars wrong
I don't know what is wrong, I have this JavaScript function: 我不知道怎么了,我有这个JavaScript函数:
<script charset="utf-8" type="text/javascript">
$(document).ready(function(){
//initialize the javascript
App.init();
@if(Session::has('message'))
var msg = '{{ Session::get('message') }}';
console.log(msg);
swal({
title: "",
text: 'compañia',
type: "warning",
confirmButtonText: "Ok!",
closeOnConfirm: false
});
$(window).bind("load", function() {
$.gritter.add({
title: 'Atencion',
text: 'compañia',
image: '{{ asset('images/clipboard_icon.png') }}',
class_name: 'danger',
time: ''
});
return false;
});
@endif
});
</script>
The problem is that sweet alerts doesn't display: 'compañia'
it displays 'compañia'
but the gritter message is correctly displaying the word. 问题在于,甜蜜警报不会显示:
'compañia'
它显示'compañia'
但是gritter消息正确显示了该单词。 (See picture) (见图片)
As you can see the red gritter correctly displays the word, but the sweet alert doesn't, 如您所见,红色的抱怨者正确地显示了该词,但是甜蜜的警告却没有,
The file is UTF-8 encoded, so is the meta and the script also just in case, and before you ask why I put 'compañia'
its part of a larger message that is send by Laravel on the session and retrieved by the view in that format. 该文件是UTF-8编码的,因此元和脚本也是以防万一,在您问为什么我将
'compañia'
放到会话中由Laravel发送并由以这种格式查看。
Anyway my real question is why does the gritted display the word fine and how can I fix it so it works also on sweet alert. 无论如何,我真正的问题是,为什么粗砂纸会显示出很好的单词,我该如何解决这个问题,使其在发出甜蜜警报时也能正常工作。
I just fixed it by adding html: true
to the function: 我只是通过在函数中添加
html: true
来修复它:
swal({
title: "",
text: 'compañia',
type: "warning",
confirmButtonText: "Ok!",
closeOnConfirm: false,
html: true
});
I fixed it by setting html to the text. 我通过将html设置为文本来修复它。
swal({
title: "",
text: 'compañia',
type: "warning",
confirmButtonText: "Ok!",
closeOnConfirm: false,
html: 'compañia'
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.