-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Excel 95 Cyrillic encoding problem #1018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The problem is relevant at the moment. |
I've made a pull request to fix the issue #1484, but as far as I've never made pull requests to any 3rd party libs before, I'm not sure if it is correct or not. Also unfortunately I don't have enough time to add unit tests for this feature now, so I don't know is it acceptable or not. Anyway you can use my fork until it is merged |
Thanks you. |
clock($item['g']);
clock(mb_detect_encoding($item['g']));
//здесь ничего не изменилось и всё те же краказябры
$item['g'] = mb_convert_encoding($item['g'], 'utf-8', mb_detect_encoding($item['g']));
$item['f'] = mb_convert_encoding($item['f'], 'utf-8', mb_detect_encoding($item['f'])); У меня получается так, что оно то выставило CP1252 но после получания данных там всё равно кряказябры которые не получается в нормальные символы конвертировать. Этим методом я получаю данные с файла. public static function toArray($filepath)
{
$spreadsheet = IOFactory::load($filepath);
$worksheet = $spreadsheet->getActiveSheet();
$rows = [];
foreach ($worksheet->getRowIterator() as $row) {
$cell_iterator = $row->getCellIterator();
$cell_iterator->setIterateOnlyExistingCells(false);
$cells = [];
foreach ($cell_iterator as $key => $cell) {
$cells[strtolower($cell->getColumn())] = $cell->getValue();
}
$rows[] = $cells;
}
return $rows;
} |
А это файл с которым у меня проблемы https://dropmefiles.com/Mvhah |
Я вот так изменил код и начало работать. |
А в каком файле Вы это сделали ? |
my PR was merged, so there is a setter method now, you can use it in your code explicitly: |
Спасибо!
С уважением,
Киселёв Станислав
тел: +7 (916) 767-0014 ( WhatsApp )
тел: +7 (925) 001-6712
<http://import.torokh.ru>Восстановление данных Apple Xsan рейдов
<http://xsan.torokh.ru>
Программирование на Delphi, Objective-C ( iPhone/iPad/MacOS X )
<http://www.torokh.ru>
вт, 13 окт. 2020 г. в 13:48, Pavel Alazankin <[email protected]>:
… Проблема актуальна на данный момент.
Я сделал запрос на перенос, чтобы исправить проблему № 1484
<#1484> , но, поскольку я
никогда раньше не делал запросы на перенос к каким-либо сторонним
библиотекам, я не уверен, правильно это или нет. Также, к сожалению, у меня
сейчас недостаточно времени для добавления модульных тестов для этой
функции, поэтому я не знаю, приемлемо это или нет.
В любом случае вы можете использовать мою вилку,
<https://github.com/boltunoreh/PhpSpreadsheet> пока она не будет
объединена
Я вот так изменил код и начало работать.
[image: Аннотация 2020-05-22 143704]
<https://user-images.githubusercontent.com/20288556/82664183-d80cae00-9c39-11ea-95c2-e795cb3b7107.png>
[image: Аннотация 2020-05-22 143704ffff]
<https://user-images.githubusercontent.com/20288556/82664160-cb885580-9c39-11ea-84e6-58e8da9c590a.png>
А в каком файле Вы это сделали ?
my PR was merged, so there is a setter method now, you can use it in your
code explicitly:
$reader->setCodepage('CP1251')
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1018 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIJ4QSOVIAJCLF5B3N7JDLSKQWBHANCNFSM4HY73NUQ>
.
|
Так же и осталось (
|
Fixed by PR #1484 in June 2020. |
This is:
What is the expected behavior?
Excel 95 files with cyrillic text are processed fine
What is the current behavior?
Cyrillic text can't be decoded well because if excel file doesn't contain codepage record, CP1252 charset is used by default and it can't be changed explicitly
What are the steps to reproduce?
Step 1: find an excel 95 file with cyrillic text
Step 2:
Step 3: you can see that output contains bad symbols instead of valid cyrillic:
Using iconv() or mb_convert_encoding() do not help while changing default codepage to CP1251 does. But there is no way to set codepage.
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet v. 1.7.0
PHP 5.6
The text was updated successfully, but these errors were encountered: