protected function convertString($str, $use_codepage = false)
    {
        if ($convert && $this->codepage
            && ($charset = rcube_charset::$windows_codepages[$this->codepage])
        ) {
            $str = rcube_charset::convert($str, $charset);
        }
        else if (strpos($str, "\0") !== false) {
            $str = rcube_charset::convert($str, 'UTF-16LE');
        }

        $str = rtrim($str, "\0");

        return $str;
    }