public function parse($filename, InterpreterInterface $interpreter)
    {

        // for mac's office excel csv
        ini_set('auto_detect_line_endings', true);

        // initialize the configuration
        $delimiter      = $this->config->getDelimiter();
        $enclosure      = $this->config->getEnclosure();
        $escape         = $this->config->getEscape();
        $fromCharset    = $this->config->getFromCharset();
        $toCharset      = $this->config->getToCharset();
        $flags          = $this->config->getFlags();
        $ignoreHeader   = $this->config->getIgnoreHeaderLine();

        // query whether or not the charset has to be converted
        if ($fromCharset === null) {
            $url = $filename;
        } else {
            $url = ConvertMbstringEncoding::getFilterURL($filename, $fromCharset, $toCharset);
        }

        // initialize the CSV file object
        $csv = new \SplFileObject($url);
        $csv->setCsvControl($delimiter, $enclosure, $escape);
        $csv->setFlags($flags);

        // backup current locale
        $originalLocale = setlocale(LC_ALL, '0');
        setlocale(LC_ALL, 'en_US.UTF-8');

        // process each line of the CSV file
        foreach ($csv as $lineNumber => $line) {
            if ($ignoreHeader && $lineNumber == 0 || (count($line) === 1 && trim($line[0]) === '')) {
                continue;
            }
            $interpreter->interpret($line);
        }

        // reset locale
        $localeArray = array();
        parse_str(str_replace(';', '&', $originalLocale), $localeArray);
        setlocale(LC_ALL, $localeArray);
    }