You can not keep switching the charset of the page by executing
	ini_set("default_charset","UTF-8") and
	ini_set("default_charset","ISO-8859-1")
in turn.

That's not how ini_set works.

The charset specified by the last ini_set("default_charset","...")
will be the charset of the page.

Any HTML code and JavaScript code on the page will be interpreted
in the charset.