truncate string with escaped forien charasters
<p>I have the following function to truncate text:</p>

<pre><code> /**
     * Removes HTML tags, crops to 255 symbols
     *
     * @param string $unformatted
     */
    public function formatShortDescr($unformatted) {
        if(strlen($unformatted)&lt;1) return;

        $long_text = strip_tags(trim($unformatted));
        $max_length = 255;

        if(strlen($long_text) &gt; $max_length){
            $short_text = (substr($long_text,0,$max_length));
        } else {
            $short_text = $long_text;
        }
        return $short_text;
    }
</code></pre>

<p>E.g this:
<code>&lt;p&gt;Victory har utvecklats f&amp;ouml;r att passa den &amp;auml;gare som beh&amp;ouml;ver en kompakt, ........</code> get converted into: <code>Victory har utvecklats f&amp;ouml;r att passa den &amp;a</code></p>

<p>How can I set it to never cut a string half way through break the html entities? </p>
