is an HTML object. When .text() is executed, all HTML objects are decoded to their character values.
Instead of comparing using an entity, compare using the actual raw character:
var x = td.text(); if (x == '\xa0') { // Non-breakable space is char 0xa0 (160 dec) x = ''; }
Or you can also create a character from a character code manually in its irrevocable form:
var x = td.text(); if (x == String.fromCharCode(160)) {
Further information on String.fromCharCode is available here:
fromCharCode - MDC Document Center
More information about character codes for different encodings can be found here:
Windows-1252 Charset
UTF-8 Charset
Andrew Moore Mar 08 '11 at 20:35 2011-03-08 20:35
source share