HTML Entity – Unicode Escape

For Unicode only:

'Français'
  .replace(/[\u0080-\u10FFFF]/ug, function(c){
                                    return "&#x" + ("0000" + c.charCodeAt(0).toString(16)).toUpperCase().substr(-4) + ";" 
                                  });

output:

Français


For everything:

'Français'
   .replace(/./ug, function(c){
                     return "&#x" + ("0000" + c.charCodeAt(0).toString(16)).toUpperCase().substr(-4) + ";"
                   });

output:

Français