Is there some http GET response that I can add to fix an encoding problem on the client web browser?

StackOverflow https://stackoverflow.com/questions/3154199

Pergunta

I have an embedded web server written in C using uIP libraries, in a microcontroller, which outputs the following static text in response to an http get. It is shown below as a C literal string:

"HTTP/1.0 200 OK\r\n"
"Server: UIP/1.0 (http://www.something.com/)\r\n"
"Content-type: text\html\r\n"

Right after that comes the doctype string \ and the \ ... \</html> body of the page requested. I did not write this code, but it was handed to me. Now I try it on Opera, Firefox, and Internet Explorer. The entire webpage is using Ansi/C and no special strings or bytes. But it loads and displays properly only on Opera. For some reason this particular uIP based web-browser will not render on IE 8 or Firefox.

![alt text][1]

What can I add to the http headers to make my micro-web-server encoding of basic/default C/ansi codepage be detected properly for all browsers, and not just opera?

Foi útil?

Solução

Try to replace your static text to this one:

"HTTP/1.0 200 OK\r\n"
"Server: UIP/1.0 (http://www.something.com/)\r\n"
"Content-type: text/html; charset=utf-8\r\n"

NOTE : the backslash ('\') character is an esacpe character, in your static string, you did "\h" with your "text\html"

NOTE : The "charset=utf-8" part is only useful if your files are utf-8 encode

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top