Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: why do I get question marks instead of bullets ???

From: ericosman@---.--- (---- -----)
To: NULL
Date: 6/15/2004 8:58:00 AM
Thanks but ...

Is it really necessary to write a file and then read it back, just to
obtain the proper characters ?

Here's a working example , but note how it writes and then reads file
"tempSearchData.html" .

I've LOVE to avoid the write-file-then-read-it-back step .  Any ideas
????

Here's my code so far:

<!--

Adodb trial

Author:   EricOsman@r...      15-Jun-2004

-->

<html>
<head>
<title>Try adodb </title>
<script>
//+-------------------------------------------------------------
//| Here when page loads.  (on refresh too ?  On "back" button
//| that arrives at this page again ?)
//+-------------------------------------------------------------
function onLoad() {
}

//+-------------------------------------------------------------
//| Put your test code here then click the tryit button to give
//| it a world.
//+-------------------------------------------------------------
function tryit() {
document.getElementById("resultsDiv").innerHTML = "Processing ...";
var req = new ActiveXObject('Msxml2.XMLHTTP');
var url = "http://www.aaamidatlantic.com/savings/default_aloha.asp";
req.open('GET', url, false);
//req.setRequestHeader("Content-Type", 'text/xml;
charset="ISO-8859-1"');
//req.setRequestHeader("Accept-Charset", "iso-8859-1");
req.send();
   var stream = new ActiveXObject("ADODB.Stream");
   // checkStatus(http, 200);
   stream.open();
   stream.Type = 1;
   try {
     if (req.responseText.length > 0) {
       stream.Write(req.responseBody);
     }
     else {
        alert ("responseText is empty");
        return;
     }
   }
   catch (e) {
         var report = "";
         for (var i in e) {
             report += i + ":" + e[i] + "\n";
             }
         alert ("Error:\n------\n" + report);
         return;
   }
var fileName = "tempSearchData.html";
   stream.SaveToFile(fileName, 2);
   stream.close();
// This incantation from
http://www.codeproject.com/asp/gethtmlsource.asp?df=100&forumid=4081&exp=0&select=696350
//set strm2=createobject("adodb.stream")
//With strm2
//.type = 2
//.charset="euc-kr" 'Use any proper charset
//.open
//.loadfromFile 
var stream = new ActiveXObject("ADODB.Stream");
stream.Type = 2;
stream.Charset = "iso-8859-1";
stream.open();
stream.LoadFromFile(fileName);
//var t = req.ResponseText;
var t = stream.ReadText();
t = t.substring(t.indexOf("Member Benefits include"), t.length);
var endStr = "discount off first";
t = t.substring(0, t.indexOf(endStr) + endStr.length);
document.getElementById("resultsDiv").innerHTML = "done";
document.getElementById("resultsDiv").innerHTML =
    "Can you see the bullets in the this text ?<br>"
       + t;
}
</script>
<body onload="onLoad();">
<button onClick="tryit();">Let's Try It</button>
<div id=resultsDiv>
</div>
</body>
</html>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent