Skip to content

[BUG] Encoding bug with £(pound) sign #1738

@ukenpachi

Description

@ukenpachi

This is:

- [*] 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?

$sheetData = [
Code,
Price (£),
Description
]

What is the current behavior?

my csv file headers looks like "Code,Qty,Price (£),Description,RRP,Ean" what I find is that "Price (£)" is replaced with "false" the array looks like "Code,Qty,false,Description,RRP,Ean" It only does this with the pound sign, the dollar or euro is fine.

$sheetData = [
Code,
false,
Description
]

What are the steps to reproduce?

csv file

Code,Qty,Price (£),Description,RRP,Ean
01,10.15,Size 12 L

$spreadsheet = PhpOffice\PhpSpreadsheet\IOFactory::load($csvFile);
$worksheet = $spreadsheet->getAllSheets();
$sheetCount = $spreadsheet->getSheetCount();
for ($i = 0; $i < $sheetCount; $i++) {
    $sheet = $spreadsheet->getSheet($i);
    $sheetData = $sheet->toArray(null, true, false, false); //this is where the issue is at
}


### Which versions of PhpSpreadsheet and PHP are affected?
1.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions