diff --git a/js/maxlength.js b/js/maxlength.js
index a590fac..b279038 100644
--- a/js/maxlength.js
+++ b/js/maxlength.js
@@ -2,6 +2,7 @@
 
   // Make evrything local
   var ml = ml || {};
+  Drupal.maxlength = ml
   ml.options = ml.options || {};
 
   Drupal.behaviors.maxlength = {
@@ -19,7 +20,7 @@
 
       $('.maxlength', context).once('maxlength', function() {
         var options = {};
-        options['counterText'] = $(this).attr('maxlength_js_label');
+        $.data(this, 'counterText', $(this).attr('maxlength_js_label'));
         if ($(this).hasClass('maxlength_js_enforce')) {
           options['enforce'] = true;
         }
@@ -56,6 +57,7 @@
   ml.calculate = function(obj, options, count, wysiwyg, getter, setter) {
     var counter = $('#' + obj.attr('id') + '-' + options.css);
     var limit = parseInt(obj.attr('maxlength'));
+    options.counterText = $.data(obj.get(0), 'counterText');
 
     if (count == undefined) {
       if (options.truncateHtml) {
@@ -125,8 +127,8 @@
   ml.strip_tags = function(input, allowed) {
     // making the lineendings with two chars
     input = ml.twochar_lineending(input);
-    // We do want that the space characters to count as 1, not 6...
-    input = input.replace('&nbsp;', ' ');
+    // consider HTML entities (&eacute; or &nbsp; for example) as one character (artificially replaced by the character 'X')
+    input = input.replace(/&\w+;/g ,'X');
      //input = input.split(' ').join('');
     // Strips HTML and PHP tags from a string
      allowed = (((allowed || "") + "")
@@ -134,10 +136,14 @@
          .match(/<[a-z][a-z0-9]*>/g) || [])
          .join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
      var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
-         commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
-     return input.replace(commentsAndPhpTags, '').replace(tags, function($0, $1){
+         commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi,
+         tokens = /\[\[\{.+\}\]\]/gi;
+     return input
+       .replace(commentsAndPhpTags, '')
+       .replace(tokens,'')
+       .replace(tags, function($0, $1){
          return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
-     });
+       });
   };
 
   /**
