Bug Tracker

Opened 14 years ago

Closed 14 years ago

#6024 closed bug (invalid)

.getScript() works incorrectly with strings

Reported by: Xaver Owned by:
Priority: major Milestone: 1.4.2
Component: unfiled Version: 1.4.1
Keywords: Cc:
Blocked by: Blocking:

Description

Example1:

<!doctype html><html><head>

<script type="text/javascript" src="jquery.js"></script>

</head><body>

<script>

$.getScript("strings.js"); /* strings.js contains localized strings only */ document.write(str0); /* str0="str0. Строка на русском" */ document.write('<br>'); document.write(str1); /* str1="str1. A string in English" */

</script></body></html>

In this case IE displays only latin chars, but FF3.5 and Opera 10 display nothing.

Though when used with "success()" it works in another way, but incorectly too. Example2:

<!doctype html><html><head>

<script type="text/javascript" src="jquery.js"></script>

</head><body>

<script>

$.getScript("strings.js", function(){ document.write(str0); /* A string in Russian */ document.write('<br>'); document.write(str1); /* A string in English */

});

</script></body></html>

In this case IE displays only latin chars, but FF3.5 displays some trash instead of russian chars and Opera 10 display correctly, but is slow.

Change History (2)

comment:1 Changed 14 years ago by Xaver

And one more. Cannot load files that are higher up in the local folder hierarchy. Works fine for absolute paths and relative paths that are at level or lower.

comment:2 Changed 14 years ago by john

Resolution: invalid
Status: newclosed

Shouldn't your page probably have a charset specified - likely UTF-8? Not specifying one will result in malformed UTF-8 characters (as you're noticing).

Note: See TracTickets for help on using tickets.