How can js convert csv files or string to UTF-8 format

such as the title, because to import the data in the csv file, the file format is not UTF-8, it is garbled on the web page, as shown in the following figure.

if it is in UTF-8 format, the display is normal Chinese, no problem.

so I"d like to ask you how to convert CSV file format to UTF-8 through transcoding in js. Thanks a lot.

Mar.10,2021

get the original data and find a decoding library to decode


how to encode and decode the string GBK and GB2312 on the browser side?

if you read the article carefully, you will find that the author has opened up its library
you can use

npm install -S web-iconv

to install and use

Menu