View Full Version : charCodeAt Help Required
01-26-2006, 09:34 AM
I am trying to write a conversion program using charCodeAt and fromCharCode but can't understand why the numbers are bigger than 256:
alert("ž".charCodeAt(0)); ===> gives 382
alert("”".charCodeAt(0)); ===> gives 8221
Is there anything that I must set to make this be under 256
01-26-2006, 09:39 AM
The numbers are bigger than 256 because the Unicode code points for those characters are above 256.
01-26-2006, 10:03 AM
Thanks for the quick response.
I am just wondering why in VB this works out to be:
01-26-2006, 10:24 AM
Because those are the mappings for the Windows-1252 (http://en.wikipedia.org/wiki/Windows-1252) code page (http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx). But browsers use Unicode internally, and also the ECMAScript standard specify Unicode as the the character set used.
02-14-2006, 05:40 AM
Thanks for all the tips. I have bypassed the problem by mapping it with the standard character set.
Thanking you in advance!
02-14-2006, 10:00 AM
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.