I need to determine the length of string which may contain html-entities.
For example \"&darr ;\" (↓) would return length 6, which is correct, but I want these
Unfortunately, JavaScript does not natively support encoding or decoding of HTML entities, which is what you will need to do to get the 'real' string length. I was able to find this third-party library which is able to decode and encode HTML entities and it appears to work well enough, but there's no guaranteeing how complete it will be.
http://www.strictly-software.com/htmlencode