Hi there.

We've been using htdig now for a couple of months and it's been great. We
then ran it on one of our sites which has loads of links with spaces in the
link, e.g.
<a href="//https://local/this is a test.html">Link with spaces</a>

We see from your FAQs that links with spaces are 'not supported' so we had a
look at the code and came up with the following solution which appears to
work fine :-

We have added a new private function to URL.cc
String URL::chgspace(char *url)
{
    String      temp(url);
    int npos = temp.indexOf(" ");
    while ( npos > -1 )
    {
        String temp2 = temp.sub(0, npos);     // The substring before the space
        String temp3 = temp.sub(npos + 1);    // The substring after the space
        temp = temp2 << "%20" << temp3;       // Concatenate back together with a
%20
        npos = temp.indexOf(" ");             // any more spaces ?
        if ( npos < 0 )                       // Lets make sure we leave the loop
           break;
    }
    return temp;
}

Changed URL::URL(char *ref, URL &parent)
URL::URL(char *ref, URL &parent)
{

    String      temp = chgspace(ref);  // convert spaces to %20
    temp.remove("\r\n\t");             // don't remove spaces
    ref = temp;                        // no changes from here

Changed void URL::parse(char *u)
void URL::parse(char *u)
{
    String      temp = chgspace(u);   // convert spaces to %20
    temp.remove("\r\n\t");            // don't remove spaces
    char        *nurl = temp;             // no changes from here

Hope this helps, thanks for htdig.

Regards,

Steve Perrins
iSystems Development Manager
Andronicos iCommerce International
http://www.andronicos.net



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
htdig-general mailing list <[EMAIL PROTECTED]>
To unsubscribe, send a message to <[EMAIL PROTECTED]> with a 
subject of unsubscribe
FAQ: http://htdig.sourceforge.net/FAQ.html

Reply via email to