aadsm / jschardet

Character encoding auto-detection in JavaScript (port of python's chardet)
GNU Lesser General Public License v2.1
710 stars 97 forks source link

Update universaldetector.js to add missing const #92

Open luca-rath opened 7 months ago

luca-rath commented 7 months ago

If used with this options

{ detectEncodings: ["UTF-8", "windows-1252"] }

the following error occurs:

ERROR Error: Uncaught (in promise): ReferenceError: lowerDetectedEncodings is not defined
ReferenceError: lowerDetectedEncodings is not defined
    at canDetectEncoding (universaldetector.js:110:27)
    at UniversalDetector.feed (universaldetector.js:140:55)
    at runUniversalDetector (index.js:52:11)
    at exports.detect (index.js:34:13)
    at Papaparse.ts:20:30
    at _ZoneDelegate.invoke (zone.umd.js:411:30)
    at Object.onInvoke (core.mjs:11083:33)
    at _ZoneDelegate.invoke (zone.umd.js:410:56)
    at Zone.run (zone.umd.js:165:47)
    at zone.umd.js:1314:38
    at resolvePromise (zone.umd.js:1250:35)
    at zone.umd.js:1321:21
    at _ZoneDelegate.invokeTask (zone.umd.js:445:35)
    at core.mjs:10757:55
    at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:10757:36)
    at _ZoneDelegate.invokeTask (zone.umd.js:444:64)
    at Object.onInvokeTask (core.mjs:11070:33)
    at _ZoneDelegate.invokeTask (zone.umd.js:444:64)
    at Zone.runTask (zone.umd.js:210:51)
    at drainMicroTaskQueue (zone.umd.js:634:39)

With the proposed changes, the error doesn't occur. This bug has been introduced in #91