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

Chrome version 38.0.2125.101: "Failed to construct 'TextDecoder'" #179

Closed
kach opened this issue Oct 13, 2014 · 11 comments · May be fixed by sitedata/jszip#1, qmutz/jszip#2 or GOMYWAY-NETWORKS-LLC/jszip#1

Comments

@kach
Copy link

kach commented Oct 13, 2014

A user came across this error message in a project using JSZip: kach/Snapin8r#15

Do you have any idea what could be causing this?

@Stuk
Copy link
Owner

Stuk commented Oct 13, 2014

I know we have used that, but I can't find a reference to it in the current code. Are you using the latest version of JSZip? If you are, could you find out the user's browser and version?

@menasheh
Copy link

It does not work in Google Chrome Version 38.0.2125.101 m

Now that you mention it, it does get past that error in Firefox.

@Stuk Stuk changed the title "Failed to construct 'TextDecoder'" Chrome version 38.0.2125.101: "Failed to construct 'TextDecoder'" Oct 13, 2014
@Stuk
Copy link
Owner

Stuk commented Oct 13, 2014

The usage of TextEncoder and TextDecoder was removed in JSZip 2.4.0 (see 8e25faa). Please update the version of JSZip that you are using.

@Stuk Stuk closed this as completed Oct 13, 2014
@jainesh123
Copy link

@Stuk .Dont have access to my system now . Would surely post the error stack trace, first thing tomorrow.
Also, to upgrade to JSZip 2.4.0(from the older version which i have now) is there some procedure or should i simply change the content of jszip.js file ?

@Stuk
Copy link
Owner

Stuk commented Oct 13, 2014

You can just change the contents of the jszip.js file. There should be no breaking changes.

@jainesh123
Copy link

I had tried simply changing the contents of the jszip.js file with the latest version available while i was trying to debug the issue.However that threw an exception - "Cannot read property Central_directory_end of undefined" . I have typed this out of memory . Will provide the exact details of the error with stack trace first thing tomorrow.That is the reason I asked if there is some procedure to be followed while upgrading to newer version. Also what about the other files deflate.js etc?
Thanks for the help. Will get back to you in a short while.

@Stuk
Copy link
Owner

Stuk commented Oct 13, 2014

If you're using JSZip as a standalone script then make sure you're using the dist version, available here: https://github.com/Stuk/jszip/raw/master/dist/jszip.js

@jainesh123
Copy link

This is the error stack trace where i am using the previous version of JSZip.
Uncaught TypeError: Failed to construct 'TextDecoder': Please use the 'new' operator, this DOM object constructor cannot be called as a function. jszip.js:902
JSZip.utf8decode jszip.js:902
ZipEntry.handleUTF8 jszip-load.js:481
ZipEntries.readLocalFiles jszip-load.js:584
ZipEntries.load jszip-load.js:676
ZipEntries jszip-load.js:499
JSZip.load jszip-load.js:695
JSZip jszip.js:39
(anonymous function) filereader.js:30

@subratray
Copy link

I also faced the same issue: Failed to construct 'TextEncoder': Please use the 'new'operator.
Replced JSZip.js file with the one mentioned above. Still doesn't work.
Please suggest something

@Stuk
Copy link
Owner

Stuk commented Nov 18, 2014

@subratray you need to update your version of JSZip to the latest

@jainesh123
Copy link

@subratray : as a quick solution simply add 'new' @ line number 902 of your existing jszip.js.
Original line: return TextDecoder("utf-8").decode(
Now: return new TextDecoder("utf-8").decode(
Let us know if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants