[web-devel] Web.Encodings + Hack - Not sure what I'm doing wrong.

Clint Moore cmoore at wamboli.com
Tue May 18 02:29:56 EDT 2010


On Mon, May 17, 2010 at 10:48 PM, Michael Snoyman <michael at snoyman.com> wrote:
> Clint,
> Firstly, would it be possible to modify your gist so that it's runnable on
> it's own? It's hard to debug what I can't see first hand.
> Secondly, I'm not certain I understand what you're saying the problem is.
> You mean that the file contents are simply "data"?
> Michael

I was referring to the file command on most unix-es to determine the
file type by the magic number.  Here's a better explanation:

a.png is the original image, and b.png is what I get back from the
upload process.

$ file a.png b.png
a.png: PNG image, 42 x 36, 8-bit colormap, non-interlaced
b.png: data
$ ls -l a.png b.png
-rw-r--r-- 1 cmoore cmoore  611 2010-05-17 23:01 a.png
-rw-r--r-- 1 cmoore cmoore 1020 2010-05-17 23:01 b.png
$ md5sum a.png b.png
0116a68ff260fcce936b9a60c28a34d7  a.png
46e0b264fb5ab73aa2dfe8f3d40241c7  b.png


As far as making the code runnable, I can do that perhaps tomorrow.
I'd love to just tar up the code, or push it to github or somesuch,
but it's not mine.  If I can't figure it out by then I'll write a
one-off that demonstrates the problem and put it up.

In the hope that it spurs someone's 'oh yea, I remember that, you have
to x when you y!' memory, here's what I know about the problem: I know
that 1. It's almost certainly not the form used to submit the data
because 2. The example file upload script on the haskell wiki works.
This is what led me to assume that it wasn't a problem with encoding
in ghc 6.12, but now I'm not so sure due to the differences in the
file size above.

I feel compelled to point out that, as far as the data of the file is
concerned, I'm not transforming it (at least my naive Haskell
knowledge tels me I'm not).  Whether I am writing it out to a file, or
pushing it to s3, I'm still getting it from parseMultipart, and then
from fileContent.

That said, it doesn't make sense that the problem would be
web.encodings.  It's obviously being used, and more importantly,
working in other places.  It just seems like the places I could be
making a mistake are rather few.  Which, hehe, again points to an
encoding issue.

Thanks again for the help, and I will post it up tomorrow if I still
haven't figured it out.


More information about the web-devel mailing list