问题在扑朔迷离的应用程序中用特殊字符(在PDF中)解压缩PDF文件

发布于 2025-01-31 07:11:47 字数 544 浏览 5 评论 0原文

请 我找不到可以解开带有pdf名称的PDF的.zip文件的解决方案,例如:

name.zip-> nâmé.pdf。

保存文件时,这不是我可以处理的,因为当我调用解码器时已经生成异常:

import 'package:archive/archive.dart';
final zipFile = File(await projectFilePath() + zipFilename);
      final destinationDir = Directory(await projectUnzipFilePath()).path;

      // Read the Zip file from disk.
      final bytes = zipFile.readAsBytesSync();

      // Decode the Zip file
      final archive = ZipDecoder().decodeBytes(bytes);

在“ zipdecoder”中,thorw thorw a encode exceptions。

please
I'm not able to find a solution to unzip a .zip file that has a pdf with accent in name, something like:

name.zip -> nâmé.pdf.

It's not something I can handle when saving the file because the exception is already generated when I call decoder:

import 'package:archive/archive.dart';
final zipFile = File(await projectFilePath() + zipFilename);
      final destinationDir = Directory(await projectUnzipFilePath()).path;

      // Read the Zip file from disk.
      final bytes = zipFile.readAsBytesSync();

      // Decode the Zip file
      final archive = ZipDecoder().decodeBytes(bytes);

In "ZipDecoder" thorw a Encode exception.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

软的没边 2025-02-07 07:11:47

我用剥离特殊字符的正则态度解决了问题,从而在进行任何处理之前将文件重命名。

I solved the problem with a regex that strips the special characters, thus renaming the file before doing any processing.

偏闹i 2025-02-07 07:11:47

像这样的init

   try {
    // code that might throw an exception
    }
    catch(e){
    // code for handling exception
    }

somethin like this init

   try {
    // code that might throw an exception
    }
    catch(e){
    // code for handling exception
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文