Ticket #2528434 (closed defect)

Reporter


bzbugs
Opened: 12/2/09
Last modified: 05/5/10
Status: closed
Type: defect
Resolution: fixed

Owner


Adam Moore
Target Release: 3.1.1
Priority: P3 (normal)
Summary: [bz 3215572] Regression in 3.0: Get no longer uses UTF-8 as default encoding
Description:

In YUI 2.7 and earlier, the Get utility used UTF-8 as the default encoding for scripts and CSS files. In YUI 3.0, it no
longer does, even though the specification says it does. This is a big problem as we will depend on UTF-8 as the
character encoding as we internationalize YUI.

The test cases in Steps to Verify for bugzilla ticket 3215571 and here show the change: With YUI 2.7 (see bugzilla ticket 3215571), the string "æå­åã" shows up correctly on the page no matter
whether the call to Get.script specifies a charset or not. With YUI 3.0 (see test case here), the string is reduced to mojibake when the call does not specify a charset.

Type: defect Observed in Version: 3.1.0
Component: Get Utility Severity: S3 (normal)
Assigned To: Adam Moore Target Release: 3.1.1
Location: Priority: P3 (normal)
Tags: Relates To:
Browsers: N/A
URL:
Test Information:

Use a server that does not set the charset parameter in the HTTP Content-Type header for JavaScript files.

Use the following two one-line scripts:

mojibake-default.js:
var mojibake_default = "æå­åã";

mojibake-unicode.js:
var mojibake_unicode = "æå­åã";

and the following HTML page loading them:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Get Mojibake</title>
</head>
<body>

<h2>Loaded using YUI Get with default charset</h2>

<p id="default"></p>

<h2>Loaded using YUI Get with charset=utf-8</h2>

<p id="unicode"></p>

<!-- YUI 3 scripts -->
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js" type="text/javascript"></script>

<script type="text/javascript">

YUI().use("node", "get", function (Y) {

Y.Get.script("mojibake-default.js", {
onSuccess: function() {
Y.one("#default").setContent(mojibake_default);
}});

Y.Get.script("mojibake-unicode.js", {
attributes: { charset: "utf-8" },
onSuccess: function() {
Y.one("#unicode").setContent(mojibake_unicode);
}});
});

</script>

</body>
</html>

When loading the page, the string "æå­åã" should show up twice.

Change History

Adam Moore

YUI Contributor

Posted: 12/10/09
  • resolution changed to fixed
  • status changed from new to checkedin

inserted nodes get charset="utf-8" by default [fixes #2528434].
View Commit:

Adam Moore

YUI Contributor

Posted: 12/14/09

inserted nodes get charset="utf-8" by default [fixes #2528434].
View Commit:

George

YUI Developer

Posted: 03/31/10
  • component changed from Get to Get Utility
  • owner changed from Adam Moore to Adam Moore
  • status changed from checkedin to assigned

George

YUI Developer

Posted: 03/31/10
  • status changed from assigned to checkedin

George

YUI Developer

Posted: 03/31/10
  • milestone changed to 3.1.0

George

YUI Developer

Posted: 03/31/10
  • status changed from checkedin to closed

Eric Miraglia

YUI Contributor

Posted: 04/12/10
  • milestone changed from 3.1.0 to 3.1.1

Eric Miraglia

YUI Contributor

Posted: 04/12/10
  • milestone changed from 3.1.1
  • resolution changed from fixed
  • status changed from closed to reopened

Eric Miraglia

YUI Contributor

Posted: 04/12/10
  • version changed from 3.0.0 to 3.1.0

George

YUI Developer

Posted: 04/13/10
  • milestone changed to 3.1.1

Adam Moore

YUI Contributor

Posted: 04/22/10
  • status changed from reopened to checkedin

Satyen Desai

YUI Developer

Posted: 04/27/10

Sorry wrong bug

George

YUI Developer

Posted: 05/5/10
  • resolution changed to fixed
  • status changed from checkedin to closed