-
Notifications
You must be signed in to change notification settings - Fork 97
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
TypeError: Cannot assign to read only property '1' of string '' #68
Comments
The error only occurs in strict mode, but I use the same |
I discovered a workaround. It is working if I use a dynamic import const jschardet = await import('jschardet');
console.log(jschardet.detect(string)); |
These are immutable. These lines do nothing. I have no idea what the author intended to do there - it may be some kind of translation from C or Java. In which case, string slice and concatenation should occur. |
Yap, it's a translation from python, and at the time I had 0 knowledge on python 😅. |
Corrected "TypeError: Cannot assign to read only property", closes #68
@aadsm @danielgindi Thank you very much ❤️ |
When will a version with this fix be published? |
@aadsm Has this fix been published in the meantime? The workaround doesn't seem to work anymore. |
It was merged but a new version was not released |
@danielgindi Thanks, that's what I was afraid of. Are you able to build the project (see #81)? It would be possible to install the library from a Github repository (e.g. fork), but the official repository still contains the old build files (last release 3.0.0):
|
@danielgindi any updates regarding when a new version will be released ? |
I also have this issue and a new release would be great |
+1 |
I have the same issue I see the fix is merged but not released. Are you planning to release a new version soon? if not is there any work arounds? |
I'm working on this right now. I'm automating the publishing so it's automatic for new commits. |
Changes since 3.1.6: 2698f33 Version 3.1.6 (patch)\nd500c29 Version 3.1.5 (patch)\n1d1ff49 Version 3.1.4 (patch)\n3a2d31b Version 3.1.3 (patch)\n08d9559 Version 3.1.2 (patch)\n2f9d07c Version 3.1.1 (patch)\nef7d0da Version 3.1.0 (minor) \\n \\n Changes since git tag --list v* --sort=-taggerdate | head -1: \\n\n1e8ceb3 3.0.1\n4d45864 Updated browserify and jest versions\n56e10ee Cosmetic changes to the way the percentage is shown in show-size-changes.sh\n7010531 Add script to determine size changes in the distributed files\n120c0e7 npm audit --fix\na1c0607 Merge pull request #75 from danielgindi/fix/string_as_array\n2b9b07d Corrected \"TypeError: Cannot assign to read only property\", closes #68\n5a57c11 Convert the encodings tests to jest\n08e6c81 Add initial set of jest tests\n7897929 Check if given encodings exist against the denormalized list of supported encodings\naf66fa6 Add typescript support to detectEncodings\n9b49243 Add detectEncondings option\ne5945e2 Merge branch master of https://github.com/aadsm/jschardet\n71bcf43 npm audit fix\n094cb6f Merge pull request #71 from bpasero/patch-1\nc089b44 Add `detectAll` to index.d.ts\n0ae9a3c Update package-lock.json\nf71723b Add .npmignore to exclude tests
Changes since 3.1.6: 296ee53 3.2.0 2698f33 Version 3.1.6 (patch) d500c29 Version 3.1.5 (patch) 1d1ff49 Version 3.1.4 (patch) 3a2d31b Version 3.1.3 (patch) 08d9559 Version 3.1.2 (patch) 2f9d07c Version 3.1.1 (patch) ef7d0da Version 3.1.0 (minor) \n \n Changes since git tag --list 'v*' --sort=-taggerdate | head -1: \n 1e8ceb3 3.0.1 4d45864 Updated browserify and jest versions 56e10ee Cosmetic changes to the way the percentage is shown in show-size-changes.sh 7010531 Add script to determine size changes in the distributed files 120c0e7 npm audit --fix a1c0607 Merge pull request #75 from danielgindi/fix/string_as_array 2b9b07d Corrected "TypeError: Cannot assign to read only property", closes #68 5a57c11 Convert the encodings tests to jest 08e6c81 Add initial set of jest tests 7897929 Check if given encodings exist against the denormalized list of supported encodings af66fa6 Add typescript support to detectEncodings 9b49243 Add detectEncondings option e5945e2 Merge branch 'master' of https://github.com/aadsm/jschardet 71bcf43 npm audit fix 094cb6f Merge pull request #71 from bpasero/patch-1 c089b44 Add `detectAll` to index.d.ts 0ae9a3c Update package-lock.json f71723b Add .npmignore to exclude tests
Changes since 3.1.6: 2698f33 Version 3.1.6 (patch) d500c29 Version 3.1.5 (patch) 1d1ff49 Version 3.1.4 (patch) 3a2d31b Version 3.1.3 (patch) 08d9559 Version 3.1.2 (patch) 2f9d07c Version 3.1.1 (patch) ef7d0da Version 3.1.0 (minor) \n \n Changes since git tag --list 'v*' --sort=-taggerdate | head -1: \n 1e8ceb3 3.0.1 4d45864 Updated browserify and jest versions 56e10ee Cosmetic changes to the way the percentage is shown in show-size-changes.sh 7010531 Add script to determine size changes in the distributed files 120c0e7 npm audit --fix a1c0607 Merge pull request #75 from danielgindi/fix/string_as_array 2b9b07d Corrected "TypeError: Cannot assign to read only property", closes #68 5a57c11 Convert the encodings tests to jest 08e6c81 Add initial set of jest tests 7897929 Check if given encodings exist against the denormalized list of supported encodings af66fa6 Add typescript support to detectEncodings 9b49243 Add detectEncondings option e5945e2 Merge branch 'master' of https://github.com/aadsm/jschardet 71bcf43 npm audit fix 094cb6f Merge pull request #71 from bpasero/patch-1 c089b44 Add `detectAll` to index.d.ts 0ae9a3c Update package-lock.json f71723b Add .npmignore to exclude tests
Changes since 3.0.0: f3de69b Updated bundles 25f107a Updated github workflow files 4d45864 Updated browserify and jest versions 56e10ee Cosmetic changes to the way the percentage is shown in show-size-changes.sh 7010531 Add script to determine size changes in the distributed files 120c0e7 npm audit --fix a1c0607 Merge pull request #75 from danielgindi/fix/string_as_array 2b9b07d Corrected "TypeError: Cannot assign to read only property", closes #68 5a57c11 Convert the encodings tests to jest 08e6c81 Add initial set of jest tests 7897929 Check if given encodings exist against the denormalized list of supported encodings af66fa6 Add typescript support to detectEncodings 9b49243 Add detectEncondings option e5945e2 Merge branch 'master' of https://github.com/aadsm/jschardet 71bcf43 npm audit fix 094cb6f Merge pull request #71 from bpasero/patch-1 c089b44 Add `detectAll` to index.d.ts 0ae9a3c Update package-lock.json f71723b Add .npmignore to exclude tests Bundle size changes since v3.0.0: * dist/jschardet.js +3135 (465888 -> 469023) * dist/jschardet.min.js +3460 +0.01% (335803 -> 339263)
The error
is thrown in
jschardet/src/sjisprober.js
Line 73 in 13ddd7e
in my Angular 11 project, when I select cp1252.txt in the input of my
AppComponent
app.component.ts
I only have this issue in a larger Angular project. I tried to reproduce it in a new Angular project as minimal example, but the TypeError is not thrown in this project. I suspect that some (build) configuration is different between the two projects, but I can't think of what that might be. Do you have any idea?
Besides, what should
actually do?
this._mLastChar
is a string. They are immutable in JavaScript, aren't they?https://stackoverflow.com/q/68568242/1065654
The text was updated successfully, but these errors were encountered: