Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-115] HTTPClient doesn't seem to work with some URLs

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:52:02.000+0000
Affected Version/sn/a
Fix Version/sRelease 0.7.0
ComponentsiOS
Labelsn/a
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:23:50.000+0000
Updated2011-04-17T01:52:02.000+0000

Description

Here's a test case. the responseText comes back empty.

<html>
    <head>

    </head>

<body> 
    <div style='-webkit-border-radius:8px;
    background-color:#FFFFCC;
    border:#878787 solid 1px;
    font-size:12pt;
    overflow:hidden;
    padding:0;
    position:relative;
    display:block;
    height:auto;
    width:auto;
    margin:3px 9px 17px;
    list-style:none'>
        <p id='salmodia'>Carregando ...</p>
    </div>
    <script>
    var xhr = Titanium.Network.createHTTPClient();
    // set on ready state change function
    
    xhr.onreadystatechange = function() 
    {
        if (this.readyState == 4)
        {
            Titanium.UI.createAlertDialog({message:this.responseText}).show();
            document.getElementById('salmodia').innerHTML = this.responseText;
        }
    };

    // open the client
    xhr.open('GET','http://www.liturgiadashoras.org/Horas/1terca_laudes.htm');
    
    // send the data
    xhr.send(null);

    </script>
</body>
</html>

Comments

  1. Blain Hamon 2011-04-15

    It turns out the page in question was in a Windows 1252 charset. The fix has been made and pushed so that the charset is detected (not many charsets yet) and returned unmodified by responsetext. For inserting in html, this is okay. However, calling titanium methods with a non-UTF8 charset does run the risk of the API treating it as Mac Roman.

JSON Source