Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #24600
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: copyright symbol |
| Date | 2014-06-04 11:06 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <2339146.HsSRG6Ygpm@PointedEars.de> (permalink) |
| References | <V_adnebgvuRUPxPOnZ2dnUVZ_vudnZ2d@westnet.com.au> |
Andrew Poulos wrote: > I have an MS SQL Server database with a copyright symbol in a field of > data type varchar(80). When this is read by JScript in a classic ASP and > then displayed in the page the symbol displays as a black diamond with a > question mark in it. That is a possible rendering of U+FFFD REPLACEMENT CHARACTER. It is used here because the code sequence leading to the character in the database (A9) is not a proper UTF-8 code sequence (A9 is reserved as continuation byte). <https://en.wikipedia.org/wiki/ISO-8859-1#Codepage_layout> > If I change the page's charset from > <meta charset="UTF-8"> > to > <meta charset="iso-8859-1"> > the symbol correctly displays as a copyright symbol. > > Why does changing the charset "fix" the display of the symbol? > > I'd rather keep the charset as UTF but I'm at a loss as to what's going > on. The term “charset” is historical and misleading. This “meta” element specifies the character *encoding* of the resource unless there is an HTTP “Content-Type” header field value that takes precedence. This client-side change has an effect, so you are not serving a “Content-Type” header field value with a ”charset” parameter; your server-side code is incomplete or in error. <http://www.w3.org/TR/2014/CR-html5-20140204/infrastructure.html#fetching-resources> UTF-8 is the Unicode encoding that uses 8 bits per code unit. A Unicode character, precisely its code point, can be encoded with up to four such code units. <http://unicode.org/faq/> > Do I need to change the data type? No. > Do I need to encode the symbol before it goes into the database? No, but it would be a good idea. > Do I need to unescape/decode the value from the database? Yes, you need to *re*code string values if the database uses a different character encoding than the document resource you are generating. This problem has very little to do with ECMAScript implementations. Next time, do research. <http://www.joelonsoftware.com/articles/unicode.html> -- 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 | Next in thread | Find similar | Unroll thread
copyright symbol Andrew Poulos <ap_prog@hotmail.com> - 2014-06-04 14:36 +1000
Re: copyright symbol "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2014-06-04 08:51 +0300
Re: copyright symbol "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-04 10:37 +0200
Re: copyright symbol Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-04 11:06 +0200
Re: copyright symbol Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-04 14:34 +0200
Re: copyright symbol "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2014-06-04 15:41 +0300
Re: copyright symbol Andrew Poulos <ap_prog@hotmail.com> - 2014-06-05 10:28 +1000
Re: copyright symbol "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-05 09:12 +0200
Re: copyright symbol Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-04 11:21 +0000
csiph-web