Microsoft MVP성태의 닷넷 이야기
XMLHTTP 에서 반환받은 non-XML 데이터를 보여주는 모듈 [링크 복사], [링크+제목 복사],
조회: 10674
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

뉴스그룹에 올라온 소스입니다.
VB 스크립트로 작성한 Binary -> ASCII 디코딩 소스인데, XMLHTTP 의 반환값을 해석하는 데에 유용하게 쓸 수 있습니다.

보통 XMLHTTP 가 XML 문서가 아닌 반환값에 대해서는 Binary 데이터만을 보여주어서 한글이 깨져 보이게 됩니다. 즉, 한글이 포함된 HTML 문서의 경우에는 아래에서 보여주는 BinDecode VB 함수를 사용하시면 됩니다.

한가지 주의하실 것은, 아무래도 Script 함수이다 보니 조금 긴 HTML 텍스트의 경우에는 과도한 루프와 문자열 연산때문에 CPU 부하가 너무 걸린다는 것이죠. 스크립트로는 극복할 수 없고, 만약 ActiveX 를 배포할 수 있는 상황이라면 VC++ COM 개체로 구현하시는 것도 좋은 방법일 수 있습니다.


<script language="javascript">

function ViewHtmlPage()
{
    var x = new ActiveXObject("Microsoft.XMLHTTP")
    x.open("get","test.asp",false);
    x.send();
    var strv = x.responseBody;
    document.body.innerHTML = BinDecode(strv);
}
</script>

<script language="vbscript">
'-----------------------------------------
' BinDecode (바이너리 -> 아스키 변환)
' mongmong - 2003. 2
'-----------------------------------------
    Public Function BinDecode(byVal binData)
        Dim i, byteChr, strV
        For i = 1 to LenB(binData)
            byteChr = AscB(MidB(binData,i,2))
            If byteChr > 127 Then
                i = i + 1
                strV = strV & Chr("&H" & Hex(byteChr) & Hex(AscB(MidB(binData,i,2))))
            Else
                strV = strV & Chr(byteChr)
            End if
        Next
        BinDecode = strV
    End Function
</script>









[최초 등록일: ]
[최종 수정일: 2/15/2004]


비밀번호

댓글 작성자
 




... 31  32  33  34  35  36  37  [38]  39  40  41  42  43  44  45  ...
NoWriterDateCnt.TitleFile(s)
239정성태4/18/200611633Display a Web Page in a Plain C Win32 Application
238정성태4/17/200611552ASP.NET 2.0 의 Provider 관련 쪽 소스 공개
237정성태4/17/200611253Microsoft Application Verifier
236정성태4/17/200612514IIS6 - IE static resource caching problem
235정성태4/13/200611164"Atlas" Control Toolkit for April CTP Released
234정성태4/13/200611515Access Visual Studio 2005 Team System From Macintosh and UNIX Systems, and from within the Eclipse IDE
233정성태4/13/200611206More Workflow Videos
232정성태4/13/200612178Microsoft Visual C++ 2005 Redistributable Package
231정성태4/13/200611687Windows Presentation Foundation Hands-On-Labs - February 2006 CTP
230정성태4/13/200611530Microsoft Management Model Designer
229정성태4/13/200612537Discovery Wizard for SharePoint
228정성태4/13/200612071TeamPlain Web Access for Team System
227정성태4/13/200611879Scrum for Team System Released
226정성태4/13/200611801Visual Studio Team Foundation Server MSSCCI Provider Version 1.0
224정성태4/13/200611361VC++ - GroupLab Component Library
223정성태4/13/200610498MSBuild Community Tasks Project releases new version
225정성태4/13/20069918    답변글 Visual Studio 2005 Web Application Projects (RC1)
222정성태4/13/200610966Visual Studio 2005 Security Features and Tools
220정성태6/8/200610863Shared Source Common Language Infrastructure 2.0 Release [1]
219정성태8/4/200610705Simple List Extensions Specification
218정성태4/13/2006113023rd party library - EZShellExtensions.Net 1.0 [1]
217정성태4/13/200611074Bug Details: GC fails to load in server mode if config file contains none ASCII characters
215정성태4/13/200611220http://www.400plusdifferences.com/
214정성태4/13/20069703Team Foundation Server, Biztalk 2006
216정성태4/13/200611082    답변글 Team Foundation Server 시험판 공개 다운로드
213정성태4/13/200611165Introduction to the MSN Messenger Activity SDK
... 31  32  33  34  35  36  37  [38]  39  40  41  42  43  44  45  ...