Q:

How to convert DOM node text value to UTF-8 in JavaScript?

I need to send a text content of an HTML node over Ajax request, but first convert it to UTF-8. Is that possible?
Thanks!

A:

function encode_utf8( s )
{
  return unescape( encodeURIComponent( s ) );
}

function decode_utf8( s )
{
  return decodeURIComponent( escape( s ) );
}

from http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html
use it like this...
encode_utf8(document.getElementById(id).textContent);

