ZipArchive.st
branchjv
changeset 4484 d9fdadaba27e
parent 4309 637a89222029
child 4681 87d6e69daf7b
--- a/ZipArchive.st	Fri Mar 17 23:03:26 2017 +0000
+++ b/ZipArchive.st	Thu Jun 15 15:21:14 2017 +0100
@@ -4959,6 +4959,14 @@
 "/    ].
     fileName:= String new:fileNameLength.
     aStream nextBytes:fileNameLength into:fileName.
+    "/ If bit 11 of general purpose bit flag is 1, then
+    "/ fileName is UTF8 encoded.
+    "/ 
+    "/ See ZIP spec, section 4.4.4
+    "/ https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
+    (generalPurposBitFlag isBitSet: 12"1-based indexing") ifTrue:[ 
+        fileName := fileName utf8Decoded.
+    ].
 
     extraFieldLength ~~ 0 ifTrue: [
 "/        (aStream position + extraFieldLength) > endOfArchive ifTrue: [
@@ -4974,7 +4982,18 @@
 "/        ].
         fileComment := String new:fileCommentLength.
         aStream nextBytes:fileCommentLength into:fileComment.
+        "/ If bit 11 of general purpose bit flag is 1, then
+        "/ fileName is UTF8 encoded.
+        "/ 
+        "/ See ZIP spec, section 4.4.4
+        "/ https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
+        (generalPurposBitFlag isBitSet: 12"1-based indexing") ifTrue:[ 
+            fileComment := fileComment utf8Decoded.
+        ].
+
     ].
+
+    "Modified: / 15-06-2017 / 13:41:46 / jv"
 !
 
 rewriteCrcAndSizeTo:aStream