Menu

#400 Problem with file name when saving in some formats

v1.0_(example)
open
nobody
None
5
2023-12-09
2022-02-20
No

When saving to GIF, PNG, PNM and JPG, the filename is corrupted in the utf-8 console. Ubuntu 21.10. gscan2pdf version 2.12.5.

1 Attachments

Discussion

  • Jeffrey Ratcliffe

    Thanks for the report. I only see the problem in the output in the log file. The filename itself is properly encoded. Is this what you are seeing, too?

     
  • Aleksandr Nadvorny

    Thanks for the answer. When you specify a file name in Russian letters without an extension, saving the file name with a picture (jpg, etc.) also spoils. I tried to understand the problem in the code and, in my opinion, the problem in the function save_image. There is no call to utf8on ($ filename); just as it did in savepdf .

     
  • Martin Kimmerle

    Martin Kimmerle - 2023-11-19

    Thanks for reporting this and for the hint regarding save_image and _utf8_on/_utf8_off. I created a patch which is quite simple.

    In fact this issue has already been fixed for all other file types other than images in commit f8b1cc (”Fixed saving PDFs with non-ASCII characters in the path and no extension“), which closed bug #312.

    Maybe you want to refactor the code by moving the _utf8_* function calls and the comment (

    # a filename returned by Gtk3::FileChooserDialog containing utf8 is
    # not marked as utf8. This is then mangled by the append operation
    # below, but not for the operations than come afterwards, so just
    # turning on utf8 for the append.
    

    ) to a separate function, e.g. utf8_append().

     
  • Jeffrey Ratcliffe

    Thanks for the patch. I'm in the middle of a complete rewrite in Python, where the utf8 handling is transparent and therefore should not suffer from this problem.

     

Log in to post a comment.

MongoDB Logo MongoDB