calvinmetcalf / shapefile-js

Convert a Shapefile to GeoJSON. Not many caveats.
http://calvinmetcalf.github.io/shapefile-js/
714 stars 228 forks source link

Failed to construct 'TextDecoder': The encoding label provided ('UTF-8') is invalid. #207

Closed phuongnv0800 closed 2 months ago

phuongnv0800 commented 2 months ago

Error loading Shapefile: RangeError: Failed to construct 'TextDecoder': The encoding label provided ('UTF-8') is invalid. at browserDecoder (decoder-browser.js:26:19) at dbfRowHeader (index.js:16:13) at module.exports (index.js:68:20) at index.js:97:15 at Array.map () at shp.parseZip (index.js:86:23) at index.js:113:16 at _ZoneDelegate.invoke (zone.js:368:26) at Object.onInvoke (core.mjs:14714:33) at _ZoneDelegate.invoke (zone.js:367:52) How to fix for using shapfile contain character á, à, ố, ..... Tks

calvinmetcalf commented 2 months ago

if your shapefile does not have a .cpg it should default to utf8 and work fine, what is the contents of the .cpg in your shapefile if it is present?

phuongnv0800 commented 2 months ago

tks, i replace UTF-8 to UTF8 and it work fine