Well, .xls is not really what I would call "encoded in UTF-8". If
there are any strings present in the .xls file, then those are encoded
in UTF-8. But most of the file is binary.
So the main thing you need to do is make sure you are working with a
stream of raw bytes, not characters. Now, I have practically no Web
experience, and I don't know how to make sure web.py is reading in a
stream of bytes (investigate lines 6 and 13), but I would imagine that
setting the content type to "text/html; charset=utf-8" isn't right.
Later, once you've got that sorted out, when it's time to write out
the content, don't do
with open(fullpath, 'w') as f_out:
This is definitely not going to work. It needs to be
with open(fullpath, 'wb') as f_out:
Perhaps someone familiar with web.py will offer more specific advice.
In fact, you currently don't have a Python Excel issue at all, but
just a how-to-handle-binary-files-on-the-Web issue. So if web.py has
a mailing list or forum, go check that out instead! Happy hunting!
John Y.