That's very nice script, just minor detail:

Цитата Сообщение от breeze Посмотреть сообщение
str = string.gsub(str, ".?$","")
str = string.gsub(str, "^.?","")
that removes any first and last byte of the argument, if you want that, you can skip regex completely and do the simpler: str = string.sub(str,2,-2)

or if you want to remove only quotes and do no change to string without quotes, you can use more specific gsub regex: str = string.gsub(str,"^"(.*)"$","%1")

I would still rather use `iconv` which is more complete and can convert from many encodings to many encodings, and is available almost everywhere in *NIX world (not sure about windows, I guess with win10 and later you can just simply move everything to WSL and use linux inside windows, to avoid all the windows troubles and deficiencies in tools). But if you don't want to depend on external tool, this script is nice and easy to patch if one needs something new or non-standard.