js file in Grails project. Problem
for example, I create .gsp page:
<html>
<head>
<g:javascript>
alert("Текст сообщения")
</g:javascript>
</head>
<body>
</body>
</html>
and write some text in cyrillic - all work fine, rezult: alert window "Текст сообщения", but, when i create gsp pag开发者_开发问答e:
<html>
<head>
<link rel="stylesheet" href="${resource(dir:'js/resources/css',file:'ext-all.css')}" />
<g:javascript src="test.js"></g:javascript>
</head>
<body>
</body>
</html>
and connect to the page test.js file:
alert("Тестовое сообщение");
i have a problem, result: alert window with text: "???????"
I think the problem is that the Grails does not properly handle character encoding External js file.
What should I do? please help
have you tried setting the charset attribute to
<g:javascript src="test.js" charset="UTF-8"></g:javascript>
(and/or changing whatever the encoding in your file is)
精彩评论