Hi All in phpinfo page I find the charset is UTF-8. Content-Type text/html; charset=UTF-8 I want to remove the charset to null witout changing in php.ini file is it possible.
-
have you try header("Content-Type text/html; charset=ANY_THING_THAT_NOT_STANDARD_CHRSET") ?MBarsi– MBarsi2011-05-27 09:39:38 +00:00Commented May 27, 2011 at 9:39
-
1There is no such thing as a "null charset".Piskvor left the building– Piskvor left the building2011-05-27 09:41:47 +00:00Commented May 27, 2011 at 9:41
5 Answers
You can set on top of your file ini_set("default_charset", "");
1 Comment
A "null charset" is the same as ISO-8859-1 according to RFC 2616:
When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP.
Setting the charset to ISO-8859-1 is therefore the same as not setting any charset at all. However, since Google Chrome implements this wrong (they default to UTF-8) you should really consider to explicitly set the charset to ISO-8859-1 (or whichever charset you are using).
5 Comments
If you have the privileges to do so, you can override INI settings on a per-script basis. Otherwise you can simply output an overriding header: header("Content-type: text/html; charset=ISO-8859-1"); or include it directly in your HTML output as <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />, obviously replacing ISO-8859-1 with whatever you want.
1 Comment
header('Content-Type: text/html'); // note the absence of charset=
Note however, that there's nothing such as "null charset", there's always some kind of mapping between the bytes and characters (even ASCII is such a mapping, not The Natural Order Of Things). What you're doing is telling the browser "I don't know what charset this is, just make a guess" - which may or may not choose the actual charset.