Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/12/2011, 15:09
ocarrasco20
 
Fecha de Ingreso: diciembre-2011
Ubicación: Algarrobo
Mensajes: 17
Antigüedad: 12 años, 4 meses
Puntos: 0
Exclamación Problema con acentos objeto ResponseText en asp

Estimados recurro a ustedes nuevamente apreciando su ayuda.

Les cuento mi tema debo obtener la salida HTML de un asp y despues unirlo con un css lo cual lo realizo bien, el problema creo q son los acentos o caracteres extraños que no soporta y me envía un error asp.Otro punto importante que he cambiado ya varias veces la codificacion(ISO-8859-1, UTF-8) ambas iguales en cada lado y nada. A veces me funciona cuando trabajo con utf-8 supuestamente no me envia error asp pero solamente me muestra en un archivo html aparte solo la mitad del informe, pero en el navegador se ve completo y al tracear con firebug sale los css externos con códigos de lenguaje chino. bueno les dejo mis codigos

P.D: el informe tiene varios include html solo muestro una parte y tambi'en los css tienen declarada su codificacion.

Código HTML:
Ver original
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Informe Final</title>
  6. <link href="css/estilos_rep34.css" rel="stylesheet" type="text/css" />
  7. <link href="css/css_nuevo.css" rel="stylesheet" type="text/css" />
  8. <script type="text/javascript">
  9.    
  10.  function nuevoAjax(){
  11.    
  12.     var xmlhttp=false;
  13.      
  14.      try {
  15.        
  16.         xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  17.        
  18.      } catch (e) {
  19.          
  20.         try {
  21.            
  22.             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  23.            
  24.         } catch (E) {
  25.            
  26.             xmlhttp = false;
  27.         }
  28.      }
  29.  
  30.      if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  31.          
  32.         xmlhttp = new XMLHttpRequest();
  33.        
  34.      }
  35.      
  36.      return xmlhttp;
  37.      
  38.  }
  39.    
  40.  
  41.  
  42.   function Carga(){
  43.      
  44.     var strUrl = document.URL;
  45.    
  46.     strUrl = strUrl.toString();  
  47.     peticion = nuevoAjax();
  48.     peticion.open("GET", "crear_informe_estatico.asp?intCodColegio="+<%=Request("codigocolegio")%>+"&url="+strUrl, true);
  49.     peticion.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=iso-8859-1');
  50.    
  51.     peticion.onreadystatechange = function () {
  52.         /*
  53.        if (peticion.readyState == 4) {
  54.             document.getElementById('resultado').innerHTML = peticion.responseText;
  55.         }
  56.         */
  57.     }
  58.  
  59.     peticion.send(null);
  60.      
  61.   }
  62.  
  63. <body onLoad="Carga();">
  64. <p>El presente informe entrega una visión general de los logros alcanzados por su colegio con el proyecto eMAT durante el año escolar.</p>
  65.       <p>&nbsp;</p>
  66.       <p><a href="#Criterios"><strong> Criterios de la muestra</strong></a></p>
  67.       <p>&nbsp;</p>
  68.       <p><a href="#Resumen"><strong> Resumen informe final</strong></a></p>
  69.       <p>&nbsp;</p>
  70.       <p><a href="#Evaluaciones"><strong> Promedio de evaluaciones e incremento de logro por eje tem&aacute;tico por nivel escolar</strong></a></p>
  71. </body>
  72. </html>

Código ASP:
Ver original
  1. 'Response.AddHeader "Content-Type", "text/html; charset=utf-8"
  2.  
  3.   Dim objXML, strUrl, objHTML, objCSS, strInforme, strCSS, strHTML, strBody, i
  4.  
  5.   Const ForReading = 1, ForWriting = 2
  6.  
  7.   Set objXML = Nothing
  8.  
  9.   Set fso = Nothing
  10.  
  11.   'strUrl = "http://192.168.2.64:83/oscar/informefinal/02.1_CRITERIOS.asp?codigocolegio=19012087"  
  12.  
  13.   strUrl = Request("url")
  14.  
  15.  
  16.   Set fso = CreateObject("Scripting.FileSystemObject")
  17.  
  18.  
  19.   If fso.FileExists( Server.MapPath( Request("intCodColegio") & ".html" ) ) = False And Request("intCodColegio") <> Empty Then
  20.    
  21.     Call crear_informe( strUrl, fso )  
  22.  
  23.  
  24.   End If
  25.  
  26.    'Procedimiento generador de informe
  27.   Sub crear_informe( strUrl, fso )
  28.  
  29.      'Set objXML = Servger.CreateObject ("Microsoft.XMLHTTP")
  30.       Set objXML = Server.CreateObject ("MSXML2.ServerXMLHTTP")
  31.      'Set objXML = Server.CreateObject ("MSXML2.XMLHTTP.3.0")
  32.      'Set objXML = Server.CreateObject ("MSXML2.XMLHTTP.4.0")
  33.  
  34.      If Err then
  35.         Response.write "Error: " & Err.Description
  36.      End if
  37.    
  38.    
  39.    
  40.    
  41.     objXML.Open "GET", strURL, false, "", ""
  42.     Response.Charset = "ISO-8859-1"
  43.     objXML.send
  44.  
  45.     If objXML.Status >= 400 And objXML.Status <= 599 Then
  46.         Response.write "Error al obtener página: " & objXML.Status & " - " & objXML.statusText
  47.     Else
  48.         ResponsePage = objXML.ResponseText
  49.     End If
  50.        
  51.     'Quita llamado a funcion para no volverse a autollamar
  52.     ResponsePage = Replace( ResponsePage, "Carga();", "" )
  53.            
  54.  
  55.     Set f = fso.CreateTextFile(Server.Mappath("informe_intermedio.html"), True, True)
  56.        
  57.     'Response.AddHeader "Content-Type", "text/html; charset=iso-8859-1"
  58.    
  59.    
  60.     f.Write ResponsePage
  61.    
  62.     Response.Flush()
  63.     f.Close
  64.     Set objXML = Nothing
  65.                
  66.  End Sub

Nota: Cuando cambio en el codigo asp el segundo atributo de la funcion CreateTextFile de False a True me genera el informe pero incompleto bajandolo desde el server ftp pero en el navegador completo pero como les decia anteriormente con codigos raros en el llamado a los css externos.


Esperando su ayuda ya que esto me tiene de cabeza.


Gracias