[zip] ZipReader can handle paths in different encodings
Added ZipReader::Entry::file_path_in_original_encoding() that gets the file path in its original encoding from a ZIP archive Entry. This will be used to actually detect the encoding. Added ZipReader::SetEncoding() which allows to specify the expected encoding of the ZIP archive. ZipReader now safely converts the file paths from the assumed encoding to Unicode. This safe conversion is performed even if the assumed encoding is UTF-8. This allows to detect and sanitize invalid UTF-8 sequences by replacing them with the replacement character �. Added tests to zlib_unittests to check the encoding conversion: EncodingSjisAsUtf8, EncodingSjisAs1252, EncodingSjisAsIbm866, and EncodingSjis. BUG=chromium:1287893, chromium:953256 TEST=autoninja -C out/Default zlib_unittests && out/Default/zlib_unittests Change-Id: I534f761734b44bfce8417f97bef66bf4757df6ae Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3430328 Reviewed-by: Noel Gordon <noel@chromium.org> Commit-Queue: François Degros <fdegros@chromium.org> Cr-Commit-Position: refs/heads/main@{#967674} NOKEYCHECK=True GitOrigin-RevId: d9ecb93965cac30b44eca8fd839b0b8ac0ce1c8f
Loading
Please register or sign in to comment