HTML Entity – Infinite Convertion Bookmarklet Toolkit

javascript:(function(window, document, to_HTMLENTITY, s, is_everychar){  "use strict";
  while(true){
    s             = prompt("String To HTML-Entity.\nEnter Input String:", s);
    if(null === s) return;
    is_everychar  = prompt("String To HTML-Entity.\n[true] Convert Every Character.\n[false]Convert Just Unicode.", "false");

    prompt("HTML-Entity Result:", to_HTMLENTITY(s, "true" === is_everychar));
  }
}(
  top
, top.document
, function to_HTMLENTITY(s, is_everychar){
    var regex = true === is_everychar ? /./ug : /[\u0080-\u10FFFF]/ug
    return s.replace(regex, function(c){
      c = c.charCodeAt(0).toString(16).toUpperCase();
      c = ("0000" + c).substr(-4);
      c = "&#x" + c + ";";
      return c;
    });
  }
, ""
));

minified..

javascript:(function(window,document,to_HTMLENTITY,s,is_everychar){while(true){s=prompt("String To HTML-Entity.\nEnter Input String:",s);if(null===s)return;is_everychar=prompt("String To HTML-Entity.\n[true] Convert Every Character.\n[false]Convert Just Unicode.","false");prompt("HTML-Entity Result:",to_HTMLENTITY(s,"true"===is_everychar))}})(top,top.document,function to_HTMLENTITY(s,is_everychar){var regex=true===is_everychar?/./ug:/[\u0080-\u10FFFF]/ug;return s.replace(regex,function(c){c=c.charCodeAt(0).toString(16).toUpperCase();
c=("0000"+c).substr(-4);c="&#x"+c+";";return c})},"");