Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23961

Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do?
Date Sat, 26 Apr 2014 18:20:54 +0200
Organization PointedEars Software (PES)
Lines 69
Message-ID <1606411.7n5RFCq9OI@PointedEars.de> (permalink)
References <9521275e-7eb0-4d31-adc0-76044b3d33e1@googlegroups.com> <535a21aa$0$6703$9b4e6d93@newsspool2.arcor-online.net> <2732090.DMPj7CqQq3@PointedEars.de> <gUP6v.59558$IN1.5722@en-nntp-15.dc1.easynews.com>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1398529255 16088 eJwFwQERACAIA8BKcrIhcQRZ/wj+Y9PY4QQdgjjKw2ueY+p42GFz/YzKi68UGttdWlxI4wctbRGj (26 Apr 2014 16:20:55 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Sat, 26 Apr 2014 16:20:55 +0000 (UTC)
User-Agent KNode/4.11.5
X-User-ID eJwNyckBwDAIA7CVuGxYh5Kw/wipvoJTORkEA4u1pFUpNUfZVsn997SbefiALpbF9plzBS3fit5uiMZ14QMblxRU
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/Tm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.lang.javascript:23961

Show key headers only | View raw


Richard Damon wrote:

> On 4/25/14, 6:42 AM, Thomas 'PointedEars' Lahn wrote:
>>   2. Without a BOM, a text editor cannot tell UTF-8 encoding from
>>      a one-byte encoding like ISO-8859-1.  One can support UTF-8-capable
>>      editors by tagging source code.  For example, for Vim you can insert
>>      (at the beginning or the end; I recommend the latter to preserve
>>      line numbers) 
> 
> One nit, despite that many software packages

… as required at least by all Web standards (to be) [1][2] …

> try to make the inclusion of a BOM indicate UTF-8, it does nothing of the
> sorts. The byte sequence 0xEF 0xBB 0xBF (the representation of BOM in
> UTF-8) is a perfectly valid ISO-8859-1 character sequence (perhaps
> unlikely, but possible and legal). The BOM can be used to distinguish
> between UTF-8, UTF-16, and UTF-32, but that is not normally the thing that
> needs determining.

The UTF-8 code sequence for a Byte Order Mark (BOM), interpreted as one-byte 
characters, e.g. “” in ISO-8859-1, is a *syntax error* in ECMAScript and 
other languages (programming languages, formatting languages, and markup 
languages alike) when appearing at the beginning of source code.  Thus, 
there is no reasonable ambiguity: it is assumed that it is more probable 
that the author wanted to include a BOM in syntactically valid source code 
in order to mark the source code as Unicode text than to produce 
syntactically invalid source code.

For that reason, code sequences for a BOM are treated as whitespace in 
ECMAScript. [3]  (However, AFAICS there is no requirement that a conforming 
implementation must treat source code with a UTF-8 BOM as UTF-8; this 
includes string literals.)

> Also, a BOM is totally unneeded for a UTF-8 file. When saving data in
> UTF-16 or UCS-2, the BOM can help distinguish between UTF-16LE and
> UTF-16BE, but UTF-8 doesn't have this issue (there is only one possible
> byte order for the stream).

Fallacy: Denying the antecedent.

I have _not_ claimed that it was needed.  I have said that *without* a BOM 
it is *not* possible for a parser to tell whether the source code is UTF-8-
encoded.  Which, as I also have said, requires character encoding 
declaration by other means; namely, a suitable “Content-Type” header field 
value.  Thus, I am *well aware* that a BOM is _not_ needed.

> Lastly, those programs that want to add the BOM to indicate UTF-8
> encoding are broken in that there are some types of files where the
> addition of the BOM at the beginning of the file may well break the
> functionality of the file (particularly for scripts).

Because of the above, I know to avoid using the BOM for UTF-8 because it 
causes problems with PHP scripts (_not_ scripts in general).  In particular, 
I use an editor/IDE (Eclipse JSDT) that does not generate a BOM but still 
supports UTF-8-encoded source code.

Congratulations, you have managed to miss the point entirely while posting a 
lot of nonsense and FUD.

___________
[1] <http://www.w3.org/TR/2008/REC-xml-20081126/#charencoding>
[2] <http://encoding.spec.whatwg.org/#specification-hooks>
[3] <http://ecma-international.org/ecma-262/5.1/#sec-7.2>
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? jonas.thornvall@gmail.com - 2014-04-25 01:43 -0700
  Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? Martin Honnen <mahotrash@yahoo.de> - 2014-04-25 10:49 +0200
    Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? jonas.thornvall@gmail.com - 2014-04-25 02:30 -0700
    Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-04-25 12:42 +0200
      Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? jonas.thornvall@gmail.com - 2014-04-25 21:26 -0700
      Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? jonas.thornvall@gmail.com - 2014-04-25 21:38 -0700
      Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? jonas.thornvall@gmail.com - 2014-04-25 21:40 -0700
      Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? Richard Damon <Richard@Damon-Family.org> - 2014-04-26 11:02 -0400
        Re: I try to write out sigma sign in javascript on a canvas, but HTML encoding do not work, how should i do? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-04-26 18:20 +0200

csiph-web