Skip to content
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

Errors skip in this library! #539

Closed
monoflash opened this issue Dec 18, 2019 · 3 comments
Closed

Errors skip in this library! #539

monoflash opened this issue Dec 18, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@monoflash
Copy link
Contributor

The library is written with a error skip at all.
Because of this, excel files do not open without error messages.

I was faced with the fact that the xml crashes with an error when the openned excel file in an encoding different from UTF-8, but the library ignores this error not reporting the error in any way.

After looking at the code, I found error skipping almost everywhere, and as a result, at the first not significant error everything stops working.

To my regret, I have to abandon the use of this library, but I really hope that all the error skips will be processed and the library can be usable again.

@xuri
Copy link
Member

xuri commented Dec 18, 2019

Hi @monoflash, thanks for your issue. Please provide .xlsx file attachment that created in encoding different from UTF-8 if you can.

@monoflash
Copy link
Contributor Author

This is a financial report provided by our contractors. When I delete all confidential information from it and save it, it is transcoded to UTF-8. And along with the financial information, I can’t provide the file.
I will try later to prepare an example file that can be provided to you.

@monoflash
Copy link
Contributor Author

I manually edited the XML file contained in xlsx.
file: xl/worksheets/sheet1.xml

If you look at it, then its code page is not UTF-8, for such XML files, the XML library requires a transcoder.

The fact that XML file is not encoded in UTF-8 is normal, Microsoft Excel accepts this well.

The only thing I did was manually delete the data from XML, so when open this xlsx, there will be a message about data corruption.
I think this is enough for an example.

m2.xlsx

@xuri xuri added the enhancement New feature or request label Dec 19, 2019
@xuri xuri closed this as completed in b1b3c0d Dec 19, 2019
xuri added a commit that referenced this issue Dec 19, 2019
# Conflicts:
#	rows.go
#	sheet.go
nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
…ax-os#540)

* Fixed issue qax-os#539 Fixed error opening excel file created in encoding different from UTF-8, added logging of possible errors when decoding XML if the function does not provide exit with an error

* Added test for CharsetReader

* Fixed #discussion_r359397878

Discussion: qax-os#540 (comment)

* Fixed go fmt

* go mod tidy and removed unused imports

* The code has been refactored
nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
# Conflicts:
#	rows.go
#	sheet.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants