guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Uploading Word documents, PDFs, PNG files etc


From: Sebastian Tennant
Subject: Re: Uploading Word documents, PDFs, PNG files etc
Date: Wed, 13 May 2009 19:09:35 +0000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Quoth address@hidden (Ludovic Courtès):
> Hello,
>
> Sebastian Tennant <address@hidden> writes:
>
>> (info "(guile-1.8)Regexp Functions")
>>
>>  "Zero bytes (`#\nul') cannot be used in regex patterns or input
>>   strings, since the underlying C functions treat that as the end of
>>   string.  If there's a zero byte an error is thrown."
>
> I think it makes sense to explicitly restrict regexps to actual text as
> opposed to binary data.

On second thoughts, I'm not so sure... shouldn't users have the option
(either at compile time, or better still, in userland)?

Restricting regexps to actual text is fine... until you need to grep
binary data, or, as in this case, a combination of text and binary data.

I thought it was going to be trivial to replace the call to regexp-exec
in cgi.scm that extracted the uploaded (possibly binary) file, because
the pattern identifying the beginning of the file in the raw data string
is simple ("\n\r\n\r") - but I now realise that many calls to
regexp-exec in cgi.scm will need to be replaced, some with complex
matching patterns, so I can't see how this can be done without using
regexps, hence my changed opinion.

The only thing I can think of doing now is replacing calls to
regexp-exec with system calls to grep (which can accept binary data) -
clearly sub-optimal and non-trivial.

Anyone have any other ideas?  How easy would it be to build a guile with
a regex feature that doesn't implement this restriction on binary data?

Seb
-- 
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap





reply via email to

[Prev in Thread] Current Thread [Next in Thread]