stevelooking41@yahoo.com wrote:
[color=blue]
> Can someone explain why I don't seem unable to use document.write to
> produce a valid UTF-8 none breaking space sequence (Hex: C2A0) ?[/color]
The Unicode 4.1 character at code point 0xC2A0 is an (unnamed) Hangul
syllable, as can be seen at <http://www.unicode.org/charts/PDF/UAC00.pdf>
[color=blue]
> I've tried everyway I've been able to find to tell the browser I'm
> trying to print UTF-8 and still no luck. I'd like the first 2 tries to
> match the second two tries as far as output.
>
> <HTML>
> <meta http-equiv="Content-Type" content="application/x-script;
> charset=UTF-8">[/color]
Pardon? This is supposed to be an HTML document, is it not? So the basic
Content-Type should be text/html. And if that HTML document were UTF-8
encoded, you would not have to escape Unicode anyway. So you want to
change the `charset' parameter to ISO-8859-1 and the like, definitely
no UTF encoding.
And there is no known MIME-like label as 'application/x-script'.
I wonder how you got the idea.
You probably meant
<meta http-equiv="Content-Script-Type"
content="application/javascript; charset=UTF-8">
as described in the Informal RFC "Scripting Media Types", which is,
however, not yet used by user agents.
[color=blue]
> <SCRIPT language="javascript" charset="UTF-8">[/color]
The `language' attribute is deprecated in HTML4, the `type' attribute
is #REQUIRED. The `charset' attribute is for linked resources, i.e.
useful only in combination with the `src' attribute.
<script type="application/javascript">
See <http://www.w3.org/TR/html4/interact/scripts.html#edef-SCRIPT>
and <http://validator.w3.org/>.
[color=blue]
> var out = "UTF-8 nbsp:\xC2\xA0:Unicode:\uC2A0:Unicode:\u00A0:HTML
> nbsp: "[/color]
You need to understand what UTF and Unicode are and how UTF works,
see <http://www.unicode.org/faq/>.
[color=blue]
> document.open("text/html; charset=UTF-8");[/color]
There is no specified argument for the HTMLDocument::open() method.
Therefore, Mozilla/5.0 based user agents will ignore it if you provide
one.
<https://bugzilla.mozilla.org/show_bug.cgi?id=73409>
[color=blue]
> document.charset="UTF-8";[/color]
There is no document.charset property, hence you are creating one here.
[color=blue]
> The output looks like this:
> [...][/color]
Works as designed.
Summary: You should definitely drink more tea[tm] when coding.
PointedEars