Pregunta

I used to set:

header("Content-Type: text/plain");

when i wanted to display all chars of a PHP output, but now it seems that if there are special chars in this output (\x00 \x01 and so on), the browser tries to download the page instead of displaying it.

I tried to set the charset this way:

header('Content-Type:text/plain; charset=ISO-8859-1');

but the result is the same.

Even though this one works (browser displays as page instead of trying to download):

header('Content-Type:text/plain; charset=ISO-8859-15');

it's not really good since some chars are not really shown (like \x88 or \x91 and others).

So is there any way i can output a text/plain containing special chars and using ISO-8859-1 charset and force the browser to display this output in the page instead of trying to download it?

¿Fue útil?

Solución

This sounds like an odd experiment, and you should probably send text/html instead, possibly with pre markup.

Anyway, octets 88 and 91 (hex.) denote control characters in ISO-8859-1, with no generally accepted assignment. If they are supposed to be printable characters, you should probably declare windows-1252 instead.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top