You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [*] a bug report
- [*] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
The ability to set default codepage for Reader\Xls
All hardcoded text 'CP1252' should be change to a default variable.
E.g.:
/**
* Default Code Page
*
* @var string
*/
private $defaultCodePage='CP1252';
/**
* @param string $defaultCodePage
*/
public function setDefaultCodePage($defaultCodePage)
{
$this->defaultCodePage = $defaultCodePage;
}
'CP1252' -> $this->defaultCodePage;
in function load:
$this->codepage = $this->defaultCodePage;
in function readSummaryInformation:
$codePage = $this->defaultCodePage;
in function readDocumentSummaryInformation:
$codePage = $this->defaultCodePage;
<?phprequire__DIR__ . '/vendor/autoload.php';
// Create new Spreadsheet object$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// add code that show the issue here...
Which versions of PhpSpreadsheet and PHP are affected?
All
The text was updated successfully, but these errors were encountered:
This is:
What is the expected behavior?
The ability to set default codepage for Reader\Xls
All hardcoded text 'CP1252' should be change to a default variable.
E.g.:
/**
* Default Code Page
*
* @var string
*/
private $defaultCodePage='CP1252';
'CP1252' -> $this->defaultCodePage;
in function load:
$this->codepage = $this->defaultCodePage;
in function readSummaryInformation:
$codePage = $this->defaultCodePage;
in function readDocumentSummaryInformation:
$codePage = $this->defaultCodePage;
usage:
$inputFileName='test.xls';
$reader= IOFactory::createReaderForFile($inputFileName);
$reader->setDefaultCodePage('CP1250');
$spreadsheet=$reader->load($inputFileName);
What is the current behavior?
The default charset is CP1252 and if the source file is in CP1250 the iconv drops characters which exist in CP1250 but don't in CP1252, e.g CP1250(https://cs.wikipedia.org/wiki/Windows-1250) character "ť" 0x9D (157) doesn't exist in CP1252 (https://cs.wikipedia.org/wiki/Windows-1252) Xls->decodeCodepage('Hmotnosť') returns 'Hmotnos'
What are the steps to reproduce?
Read a file in cp1252 with text 'Hmotnosť' it will be imported as 'Hmotnos'
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
Which versions of PhpSpreadsheet and PHP are affected?
All
The text was updated successfully, but these errors were encountered: