androidでパスワード付きのzipファイルを展開するアプリを作っているのですが日本語名が含まれるzipファイルをパスワード付きZipファイルをJava(Zip4j)で参考に作したのですが解凍した際日本語の含まれるファイルが文字化けしてしまいます。
どのようにすれば文字化けぜずに解凍できるようになるのかヒントになりそうなことあれば教えていただきたいです。
よろしくお願いします。
import net.lingala.zip4j.core.ZipFile; import net.lingala.zip4j.exception.ZipException; import net.lingala.zip4j.model.UnzipParameters; public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { String zipFilePath =Environment.getExternalStorageDirectory().getPath() + "/PassZip/日本語.zip"; String destinationPath = Environment.getExternalStorageDirectory().getPath() + "/PassZip/"; File dir = new File(Environment.getExternalStorageDirectory().getPath() + "/PassZip/"); if (!dir.exists()) { dir.mkdir(); } String password = "password"; try { ZipFile zipFile = new ZipFile(zipFilePath); if (zipFile.isEncrypted()) { zipFile.setPassword(password); } zipFile.extractAll(destinationPath); } catch (ZipException e) { e.printStackTrace(); } }catch (Exception e){} } }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/05/28 09:16
2016/05/30 00:49