<br><br><div class="gmail_quote">2009/3/17 Normand Savard <span dir="ltr">&lt;<a href="mailto:nsavard@mapgears.com">nsavard@mapgears.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br></div></div>
Tamas,<br>
<br>
I checked how the tests works in mstestlib.py and the generated output.  When it&#39;s an wxs tests, if the output result is a png file, it&#39;s passed through the demime_file() function.  This function is called when  [RESULT_DEMIME] is part of the RUN_PARMS request.  It removes the Content-type.<br>

<br>
For the other tests like the ones in gdal or misc, shp2img is used and there is no such thing as Content-type in the png generated.<br>
<br>
Maybe I&#39;m missing something so please do not hesitate to comment.<br>
<br>
<br>
</blockquote></div><br><br><br>Uh, that explains many things but not all. It appears that this problem should be dedicated to the difference of the line ending interpretation of Windows and the Linux OS. On Windows we actually have 2 bytes to represent the line endings (0x0D 0x0A) which should also be stripped. So the following function would yield better results:<br>
<br>def demime_file( filename ):<br>    print &#39;   demime  %s&#39; % filename<br>    data = open(filename,&#39;rb&#39;).read()<br><br>    for i in range(len(data)-1):<br>        if data[i] == &#39;\n&#39; and <span style="color: rgb(255, 0, 0);">data[i+2]</span> == &#39;\n&#39;:<br>
            open(filename,&#39;wb&#39;).write(<span style="color: rgb(255, 0, 0);">data[i+3:]</span>)<br>            return<br>    return<br><br>But I have further issues with the de-stripped png images. It appears that the result provides invalid image unless I replace  each  0x0D 0x0A  with  0x0A in the png image file.<br>
<br>Best regards,<br><br>Tamas<br><br>