all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: naofumi@yasufuku.dev <naofumi@yasufuku.dev>
To: "Eli Zaretskii" <eliz@gnu.org>
Cc: 48902@debbugs.gnu.org, "Rudolf Adamkovič" <salutis@me.com>
Subject: bug#48902: 28.0.50; Directory names containing apostrophes and backticks cause problems
Date: Tue, 08 Jun 2021 12:39:19 +0200	[thread overview]
Message-ID: <51cb-60bf4900-1dd-2840bc80@23790836> (raw)
In-Reply-To: <m2eedd7qcl.fsf@me.com>

[-- Attachment #1: Type: text/plain, Size: 2110 bytes --]

On Monday, June 07, 2021 16:15 CEST, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Lars Ingebrigtsen <larsi@gnus.org>
> > ... so perhaps it's only a problem for the Macos build?
>
> I suspect it has to do with the special way macOS encodes non-ASCII
> file names.
>

I found the same issue with images which has Japanese filename on macOS.
Message buffer says:
------------------------------------------------------------------------
Unable to load image (image :type png :file /Users/naofumi/_git/git.sv.gnu.org/emacs_png/いーまっくす.png :scale 1 :max-width 480 :max-height 781 :format nil :transform-smoothing t) [5 times]
------------------------------------------------------------------------

At least, attached small patch could fix this.

attachments:
0001-Fix-to-show-images-with-non-ascii-filename-on-macOS.patch
ns_load_image-error-with-non-ascii-filename.png
revert-filename-NSString-in-nsimage.png
emacs_png.tar.gz

This [EmacsImage allocInitFromFile:] change was introduced by the
following commit:
------------------------------------------------------------------------
commit 747a923b9a35533f98573ad5b01fccf096195079
Author: Alan Third <alan@idiocy.org>
Date:   Tue Dec 22 23:28:25 2020 +0000

    Use new NSString lisp methods

    * src/nsfont.m (ns_otf_to_script):
    (ns_registry_to_script):
    (ns_get_req_script): Use NSString conversion methods.
    * src/nsimage.m ([EmacsImage allocInitFromFile:]): Use NSString
    conversion methods.
    * src/nsmenu.m (ns_menu_show): Use NSString conversion methods.    * src/nsselect.m (symbol_to_nsstring):
    (ns_string_to_pasteboard_internal): Use NSString conversion methods.
    * src/nsterm.m (ns_term_init):
    ([EmacsView initFrameFromEmacs:]): Use NSString conversion methods.    * src/nsxwidget.m (nsxwidget_webkit_uri):
    (nsxwidget_webkit_title):
    (js_to_lisp): Use NSString conversion methods.
    (build_string_with_nsstr): Functionality replaced by NSString    extensions.

------------------------------------------------------------------------

Regards,
--Naofumi

[-- Attachment #2: emacs_png.tar.gz --]
[-- Type: application/x-gzip, Size: 14482 bytes --]

[-- Attachment #3: ns_load_image-error-with-non-ascii-filename.png --]
[-- Type: image/png, Size: 366374 bytes --]

[-- Attachment #4: 0001-Fix-to-show-images-with-non-ascii-filename-on-macOS.patch --]
[-- Type: application/octet-stream, Size: 921 bytes --]

From bb9250b67bf887224059c337d117a720fcf79dd7 Mon Sep 17 00:00:00 2001
From: Naofumi Yasufuku <naofumi@yasufuku.dev>
Date: Tue, 8 Jun 2021 19:04:24 +0900
Subject: [PATCH] Fix to show images with non-ascii filename on macOS

* src/nsimage.m ([EmacsImage allocInitFromFile:]): Revert filename
NSString to use stringWithUTF8String instead of stringWithLispString.
(Bug#48902)
---
 src/nsimage.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nsimage.m b/src/nsimage.m
index fa81a41a51..8c7a3d9a09 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -262,7 +262,7 @@ + (instancetype)allocInitFromFile: (Lisp_Object)file
   found = ENCODE_FILE (found);
 
   image = [[EmacsImage alloc] initByReferencingFile:
-                     [NSString stringWithLispString: found]];
+                     [NSString stringWithUTF8String: SSDATA (found)]];
 
   image->bmRep = nil;
 #ifdef NS_IMPL_COCOA
-- 
2.31.1


[-- Attachment #5: revert-filename-NSString-in-nsimage.png --]
[-- Type: image/png, Size: 232034 bytes --]

  parent reply	other threads:[~2021-06-08 10:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 13:32 bug#48902: 28.0.50; Directory names containing apostrophes and backticks cause problems Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-07 14:08 ` Lars Ingebrigtsen
2021-06-07 14:15   ` Eli Zaretskii
2021-06-07 14:24   ` Lars Ingebrigtsen
2021-06-07 14:36     ` Eli Zaretskii
2021-06-07 14:13 ` Eli Zaretskii
2021-06-08 22:21   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-08 10:39 ` naofumi [this message]
2021-06-08 11:57   ` Lars Ingebrigtsen
2021-06-08 12:12     ` Alan Third
2021-06-08 12:14       ` Lars Ingebrigtsen
2021-06-08 17:45         ` Mattias Engdegård
2021-06-08 18:18           ` Eli Zaretskii
2021-06-08 19:13             ` naofumi
2021-06-08 20:08               ` Mattias Engdegård
2021-06-08 19:10           ` Alan Third
2021-06-08 19:52             ` Mattias Engdegård
2021-06-08 20:33               ` Alan Third
2021-06-09 11:40                 ` Mattias Engdegård
2021-06-09 15:19                   ` Alan Third
2021-06-11 22:09                     ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-09 11:56                 ` Eli Zaretskii
2021-06-08 18:17         ` Mattias Engdegård
2021-06-08 12:37       ` Eli Zaretskii
2021-06-08 13:00         ` Alan Third
2021-06-08 14:02           ` Eli Zaretskii
2021-06-08 16:19             ` Alan Third
2021-06-08 18:09               ` Eli Zaretskii
2021-06-08 19:24                 ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51cb-60bf4900-1dd-2840bc80@23790836 \
    --to=naofumi@yasufuku.dev \
    --cc=48902@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=salutis@me.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.