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
If you are running the javascript in a browser I would suggest using it to help you. You can create an element and set its innerHTML to be your string containing HTML-entities. Then extract the contents of that element you just created as text.
Here is an example (uses Mootools): http://jsfiddle.net/mqchen/H73EV/