[Seaside] File upload - encoding issue

Philippe Marschall philippe.marschall at gmail.com
Fri Oct 17 13:57:22 UTC 2014

On Fri, Oct 17, 2014 at 11:25 AM, Sven Van Caekenberghe <sven at stfx.eu> wrote:
> Hi Philippe, Dave,
> I made a couple of changes to Zinc to handle the problem (which basically is: mime parts such as uploaded files embedded in multipart/form-data do not have a charset parameter on their mime types, hence the encoding is not known with absolute certainty) and I think I fixed it (for Zn itself, the default encoding now is UTF-8). I added a specific test (ZnServerTests>>#testFormTest3Unspecified) for this case. Additionally, the filename is now also assumed to be UTF-8 encoded (like a file path).
> For the Zn Seaside adaptor, the story was a bit different. The adaptor uses a special Zn option to read everything binary, as Seaside wants to do its own conversions. That option did not extend to mime parts in multipart/form-data. This is now added and the adaptor now works, without altering ZnZincServerAdaptor>>#convertMultipartFileField:
> IMHO though, WAUploadFunctionTest is wrong. Basically, the use of ISO-8859-1 is questionable and should be replaced with UTF-8 for current browsers (in the methods #renderDownloadLinksOn: and #renderFileContentsOn:). Then those tests pass for uploaded text files that have non-ascii contents.
> The comment in #renderDownloadLinksOn: suggests that this problem (as described in the 1st paragraph) was noted before, the solution or fallback is wrong though, IMHO.
> The codec set in the adaptor could indeed be a fallback. I don't know if this can be accessed in regular Seaside code (like in the functional test).
> On the other hand, I can't see (and would love an example) where it makes sense, in the 21st century, to not use UTF-8 as a fallback (in case nothing was specified).

I'll have a look.

> In any case, thanks for raising this issue, it helped to improve the code.
> Sven
> PS: BTW, are there no unit tests that actually stress the functional tests ?

No unfortunately there are not. I assume you don't mean unit tests but
functional tests with Selenium or similar.


More information about the seaside mailing list