According to Joe R. Jah:
> Hi Gilles,
>
> To beat the dead horse;) Is there a simple way of removing spaces from the
> beginning of URL's ala:
> -----------------------8<-----------------------
> --- 75,82 ----
> URL::URL(char *ref, URL &parent)
> {
> String temp(ref);
> + temp.remove("\r\n\t");
> + temp.chop(' ');
> + temp.shift(' '); # or something
> ref = temp;
>
> //
> -----------------------8<-----------------------
Well, there's no "shift" method in the String class, nor anything that
simply strips characters off the front of a String. However, did you not
see my reply to Jessica Biola yesterday afternoon, in this same thread?
I did cc the list. In that, I suggested a simple fix to advance the
char * pointer past leading spaces before assigning to temp.
> And somehow turning the rest of the space into %20 in the code?
OK, this is a little bit more effort, because now you're expanding a
single character into 3, so you can't do it in place. However, you
could probably change the first few lines of the URL constructor and
parse methods like this. First, change the "u" to "ref" in the parse
method for consistency. Then, instead of simply assigning ref to temp
as String temp(ref); and then removing white space characters, you can
do this:
static int allowspace = config.Boolean("allow_space_in_url", 0);
String temp;
while (*ref)
{
if (*ref == ' ' && temp.length() > 0 && allowspace)
{
// Replace space character with %20 if there's more non-space
// characters to come...
char *s = ref+1;
while (*s && isspace(*s))
s++;
if (*s)
temp << "%20";
}
else if (!isspace(*ref))
temp << *ref;
ref++;
}
Then, you'll have to set allow_space_in_url: true in your htdig.conf
to enable this feature.
--
Gilles R. Detillieux E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba Phone: (204)789-3766
Winnipeg, MB R3E 3J7 (Canada) Fax: (204)789-3930
_______________________________________________
htdig-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/htdig-dev