开发者

js file in Grails project. Problem

开发者 https://www.devze.com 2023-01-26 10:37 出处:网络
for example, I create .gsp page: <html> <head> <g:javascript> alert(\"Текст сообщения\")

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消