brendan-duncan / archive

Dart library to encode and decode various archive and compression formats, such as Zip, Tar, GZip, ZLib, and BZip2.
MIT License
395 stars 130 forks source link

ArchiveFile.string incorrect encodes non-ASCII data (causes dataloss) #321

Closed Hixie closed 1 week ago

Hixie commented 5 months ago

The code currently says:

  _content = Uint8List.fromList(content.codeUnits);

This causes Unicode characters above U+00FE to all get turned into U+00FF and then causes the data to be encoded using ISO-8859-1, which is rather archaic.

I think that line should probably be this instead:

  _content = utf8.encode(content.codeUnits);
Hixie commented 5 months ago

Looks like the main constructor has a similar behaviour.

urusai88 commented 1 week ago

Is this already fixed?

brendan-duncan commented 1 week ago

Looks like it was changed a little while ago,. I'll close this issue.