Avatar of robrodp
robrodpFlag for Mexico asked on

Change XMLHTTP charset of opened file

I'm trying to create something like a remote include.

Apparently the code below does the trick, problem is that
I use spanish characters (á é í ó ú ñ) that are displayed
as ??? in the loaded page. Is it possible to fix this?

Thanks
<%
 response.Charset="ISO-8859-1"
 ' Url of the webpage we want to retrieve
 thisURL = "http://hospitalia.com.mx/quien.html" 

 ' Creation of the xmlHTTP object
 Set GetConnection = CreateObject("Microsoft.XMLHTTP")
 
 ' Connection to the URL
 GetConnection.Open "get", thisURL, False
 GetConnection.Send 

 ' ResponsePage now have the response of
 ' the remote web server
 ResponsePage = GetConnection.responseText

' We write out now
' the content of the ResponsePage var
 Response.write (ResponsePage)

 Set GetConnection = Nothing
 %>

Open in new window

ASPWeb Languages and Standards

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
ASKER
robrodp

It's really simple in PHP just using the code below.

Is there any ASP equivalent?
<?php include 'http://hospitalia.com.mx/quien.html'; ?>

Open in new window

Dave Baldwin

Unfortunately, javascript Only uses Unicode/UTF-8.  Running anything thru javascript will create this problem.

You can include files in ASP like: <!--#include virtual="/global/header.asp"-->
Dave Baldwin

Or <!--#include file="header.asp"-->
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER
robrodp

Problem is that <!--#include file=""--> can't handle remote files
ASKER CERTIFIED SOLUTION
Dave Baldwin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question