Cet exemple fonctionne très bien pour moi:HMTL5/UTF8 en utilisant FastCGI en C (fcgi_stdio.h)
#include "fcgi_stdio.h"
int main(void) {
while(FCGI_Accept() >= 0) {
//Standard FastCGI Example Web-page
printf("Content-type: text/html\r\n"
"\r\n"
"<title>FactCGI Example</title>"
"<h1>Example Website</h1>"
"Some text...\r\n");
FCGI_Finish();
}
return 0;
}
Mais depuis que je besoin UTF8 sur mon web caractères page, je pensais que je formater la page web en utilisant html5. Ce fut mon squelette qui rend ok comme un fichier autonome:
<!DOCTYPE html>
<html>
<head>
<title>FactCGI Example</title>
</head>
<body>
<h1>Example Website</h1>
<p>Some text...</p>
</body>
</html>
Mais une fois plié ceci dans le script fcgi comme suit, je reçois un « Internal Server Error » sur la charge de script.
#include "fcgi_stdio.h"
int main(void) {
while(FCGI_Accept() >= 0) {
//Using html5 for the web-page
printf("<!DOCTYPE html>\r\n"
"<html>\r\n"
"\r\n"
"<head>\r\n"
"<title>FactCGI Example</title>\r\n"
"</head>\r\n"
"\r\n"
"<body>\r\n"
"<h1>Example Website</h1>\r\n"
"<p>Some text...</p>\r\n"
"</body>\r\n"
"\r\n"
"</html>\r\n");
FCGI_Finish();
}
return 0;
}
Fedora 23, httpd 2.8.18, Firefox 43.0.3, gcc 5.3.1-2
recherche sur Google indique toutes les fcgi, les pages Web commencent par "Content-Type: text/html".
Ai-je commis une erreur stupide ou est-ce que fcgi ne supporte pas html5?
Existe-t-il un autre moyen d'activer le support UTF8 à l'aide de fcgi?
L'en-tête Content-type de votre version HTML5 ne vous manque pas? –