Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #24611
| Date | 2014-06-05 10:28 +1000 |
|---|---|
| From | Andrew Poulos <ap_prog@hotmail.com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: copyright symbol |
| References | <V_adnebgvuRUPxPOnZ2dnUVZ_vudnZ2d@westnet.com.au> <2339146.HsSRG6Ygpm@PointedEars.de> |
| Message-ID | <146dnVltbO_UJxLOnZ2dnUVZ_j2dnZ2d@westnet.com.au> (permalink) |
On 4/06/2014 7:06 PM, Thomas 'PointedEars' Lahn wrote: > 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> I added this js to the top of the page Response.CodePage = 65001; Response.CharSet = "utf-8"; and the symbol is now displaying correctly. For me reading about unicode is like being an island in an ocean of information where the island is my understanding and the shore is my awareness of my ignorance. The more I read about unicode (ie the more my island grows) the larger the shoreline gets. Andrew Poulos
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