#1096·PHPExcel

Read multiline cell returns escaped characters like _x000D_

Author: andy128kCreated Dec 29, 2016Updated Dec 5, 2018
LabelsComponent - Excel2007

When I read a cell which contains multiple lines of text, I receive string containing x000D.

I have created workaround, but believe this should be in phpexcel itself.

    function unescape($string)
    {
        return preg_replace_callback('/_x([0-9a-fA-F]{4})_/', function ($matches) {
            return iconv('UCS-2', 'UTF-8', hex2bin($matches[1]));
        }, $string);
    }

Link to corresponding spec: https://msdn.microsoft.com/en-us/library/ff534667(v=office.12).aspx