Remove deprecated ZipFile constructors

Change-Id: I8adb9f971a8f1f7354e8dcc80c5337ed8394a007
diff --git a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXmlTool.kt b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXmlTool.kt
index b8047e9..e7399cb 100644
--- a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXmlTool.kt
+++ b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXmlTool.kt
@@ -30,6 +30,8 @@
 import java.util.regex.Pattern
 import java.util.stream.IntStream
 import java.util.zip.GZIPOutputStream
+import java.util.zip.ZipFile
+import java.nio.charset.StandardCharsets
 import kotlin.text.Charsets
 import me.tongfei.progressbar.ProgressBar
 import me.tongfei.progressbar.ProgressBarBuilder
@@ -1061,6 +1063,13 @@
         }.toTypedArray()
     }
 
+    private fun openZipFile(path: String): ApacheZipFile =
+        ApacheZipFile.builder()
+            .setFile(File(path))
+            .setCharset(StandardCharsets.UTF_8)
+            .setUseUnicodeExtraFields(true)
+            .get()
+
     private fun getFoundryFromZipFileName(zipFileName: String): String {
         if (!zipFileName.matches(Regex(".*\\.([^/.]+)\\.zip$"))) {
             return "base"
@@ -1171,7 +1180,7 @@
                 } else {
                     foundry  // Keep original foundry for non-krill formats
                 }
-                ApacheZipFile(File(zip)).use { zipFile ->
+                openZipFile(zip).use { zipFile ->
                     processZipEntriesWithPool(zipFile, zip, zipFoundry, true)
                 }
             }
@@ -1179,7 +1188,7 @@
             LOGGER.fine("Opening ZipFile for processing: $zipFilePath")
             try {
                 // If no corresponding base ZIP exists, this IS the base ZIP
-                ApacheZipFile(File(zipFilePath)).use { zipFile ->
+                openZipFile(zipFilePath).use { zipFile ->
                     LOGGER.fine("Calling processZipEntriesWithPool, foundry=$foundry")
                     processZipEntriesWithPool(zipFile, zipFilePath, foundry, false)
                     LOGGER.fine("Returned from processZipEntriesWithPool")
@@ -1218,7 +1227,7 @@
                 } else {
                     foundry  // Keep original foundry for non-krill formats
                 }
-                ApacheZipFile(File(zip)).use { zipFile ->
+                openZipFile(zip).use { zipFile ->
                     // Iterate entries sorted by text ID to ensure consistent processing order
                     zipFile.entries.toList()
                         .filter { extractMetadataRegex.isNotEmpty() || !it.name.contains("header.xml") }
@@ -1229,7 +1238,7 @@
                 }
             }
         } else {
-            ApacheZipFile(File(zipFilePath)).use { zipFile ->
+            openZipFile(zipFilePath).use { zipFile ->
                 zipFile.entries.toList()
                     .filter { extractMetadataRegex.isNotEmpty() || !it.name.contains("header.xml") }
                     .sortedBy { getTextIdFromPath(it.name) }
@@ -3658,7 +3667,7 @@
                         val dbFactory = DocumentBuilderFactory.newInstance()
                         val dBuilder = dbFactory.newDocumentBuilder()
 
-                        ApacheZipFile(File(zipPath)).use { zipFile ->
+                        openZipFile(zipPath).use { zipFile ->
                             val entries = zipFile.entries
                             while (entries.hasMoreElements()) {
                                 val entry = entries.nextElement()