Setup: A simple Python server which serves HTML and CSS files.
A simple script which calls Prince just like described in the docs results in the following call:
Running this gives the following error in a command line:
Although the page is loaded properly in a browser. Output from LiveHTTPheaders in Firefox for the same file is:
http://localhost:8082/test.html
It seems if I overwrite the default python server and add a
- so a simple encoding information - it seems to work and prince can fetch the page. The problem continues for a CSS file which is embedded in the HTML with
which again results in a similar error output from prince:
My question is how does Prince differ from Browsers in handling CSS and HTML fetching via HTTP? Does it always assume UTF-8 if nothing is given and therefor fails to load these files?
Maybe this is not a Prince Bug at all but to solve the problem I have (I might not be able to rewrite any Server to correctly give encoding information about CSS files) to understand why this happens. I also think that UTF-8 is not the standard encoding for HTML (should be ISO-8859-1 I think) and maybe not CSS (although this might be). BTW, adding @charset "ascii" at the beginning of the stylesheet does not help.
Thanks a lot!
A simple script which calls Prince just like described in the docs results in the following call:
import subprocess
call = ['prince', 'http://localhost:8082/test.html', 'test.pdf']
subprocess.call(call);
Running this gives the following error in a command line:
prince: http://localhost:8082/test.html: error: transfer closed with 13 bytes re
maining to read
prince: http://localhost:8082/test.html: error: could not load input file
prince: error: no input documents to process
Although the page is loaded properly in a browser. Output from LiveHTTPheaders in Firefox for the same file is:
http://localhost:8082/test.html
GET /test.html HTTP/1.1
...
HTTP/1.x 200 OK
Server: SimpleHTTP/0.6 Python/2.5.1
Date: Thu, 20 Sep 2007 15:35:13 GMT
Content-Type: text/html
Content-Length: 397
Last-Modified: Thu, 20 Sep 2007 15:17:06 GMT
It seems if I overwrite the default python server and add a
Content-Type: text/html; charset=utf-8
- so a simple encoding information - it seems to work and prince can fetch the page. The problem continues for a CSS file which is embedded in the HTML with
<link rel="stylesheet" type="text/css" href="/css/test.css" />
which again results in a similar error output from prince:
prince: http://localhost:8082/test.css: warning: transfer closed with
332 bytes remaining to read
My question is how does Prince differ from Browsers in handling CSS and HTML fetching via HTTP? Does it always assume UTF-8 if nothing is given and therefor fails to load these files?
Maybe this is not a Prince Bug at all but to solve the problem I have (I might not be able to rewrite any Server to correctly give encoding information about CSS files) to understand why this happens. I also think that UTF-8 is not the standard encoding for HTML (should be ISO-8859-1 I think) and maybe not CSS (although this might be). BTW, adding @charset "ascii" at the beginning of the stylesheet does not help.
Thanks a lot!