Hi ASP.NET Experts,
I'm running into a very confusing issue which I have traced down to ASP.NET concerning £ characters in strings, if I do the same in HTML I don't get this problem.
I created a new ASP.NET project in VS2003 called 'JSTest' and modified the code to give the following in the html view of the JSTest.aspx file:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.
vb" Inherits="JSTest.WebForm1"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScrip
t content="JavaScript">
<meta name=vs_targetSchema content="
http://schemas.microsoft.com/intellisense/ie5">
<script type="text/javascript" src="./test.js" language="JavaScript"></sc
ript>
<script language="JavaScript">
var TestStringA = "!£$%^&*()";
alert("TestStringA: " + TestStringA);
</script>
</head>
<body>
<form id="Form1" method="post" runat="server">
</form>
</body>
</html>
Then I created the test.js file with the following code:
var TestStringB = "!£$%^&*()";
alert("TestStringB: " + TestStringB);
Viewing this in IE6.0 on windows XP SP2 I get a popup alert dialog with the text "TestStringB: !?$%^&*()", then the second alert dialog shows "TestStringA: !£$%^&*()". It's changing the £ sign in the string of the test.js file to a ?, but why and how do I stop this?
As I said this works as expected if I create a HTML file with the same script sections.
Can anyone shed some light on this?