Bug Tracker

Modify

Ticket #6024 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

.getScript() works incorrectly with strings

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

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

comment:1 Changed 4 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 4 years ago by john

  • Status changed from new to closed
  • Resolution set to invalid

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).

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.