diff --git a/lib/Ladybug/Type/TString.php b/lib/Ladybug/Type/TString.php
index <HASH>..<HASH> 100644
--- a/lib/Ladybug/Type/TString.php
+++ b/lib/Ladybug/Type/TString.php
@@ -31,7 +31,8 @@ class TString extends TBase
     public function __construct($var, $level, Options $options)
     {
         $this->encoding = mb_detect_encoding($var);
-        $this->length = mb_strlen($var, $this->encoding);
+        $this->length = mb_strlen($var, $this->_getEncodingForHtmlentities());        
+
 
         parent::__construct(self::TYPE_ID, $var, $level, $options);
     }
Fixed encoding problem in TString