protected function csvTextConvert($text, $mode)
    {
        $search = [chr(13), chr(10), '\'', '"'];
        $replace = ['&#13;', '&#10;', '&#39;', '&#34;'];

        if ($mode) {
            $text = str_replace($search, $replace, $text);
        } else {
            $text = str_replace($replace, $search, $text);
        }

        return $text;
    }