From: Michael Albinus <michael.albinus@gmx.de>
To: Noam Postavsky <npostavs@gmail.com>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>,
Helmut Eller <eller.helmut@gmail.com>
Subject: Re: Parsing of multibyte strings frpom process output
Date: Tue, 08 May 2018 14:47:09 +0200 [thread overview]
Message-ID: <87po2671rm.fsf@gmx.de> (raw)
In-Reply-To: <CAM-tV--9WgAX8JDZpSgr+XE+Tfwhrraf0zFFOdJkHzMxhR5C1A@mail.gmail.com> (Noam Postavsky's message of "Tue, 8 May 2018 08:21:33 -0400")
Noam Postavsky <npostavs@gmail.com> writes:
> I think making a unibyte string would fit better.
>
> (let ((res-symlink-target "/home/albinus/tmp/\\xc2\\x9abung"))
> (setq res-symlink-target (encode-coding-string
> res-symlink-target
> 'us-ascii t))
> (decode-coding-string
> (replace-regexp-in-string
> "\\\\x\\([[:xdigit:]]\\{2\\}\\)"
> (lambda (x)
> (unibyte-string
> (string-to-number (match-string 1 x) 16)))
> res-symlink-target)
> 'utf-8))
>
> Although, both methods give me "/home/albinus/tmp/\232bung", so I
> might be missing something...
Both methods are doing the same, I believe. But I like your snippet much
better than mine, so I will use it (if you don't object).
Your first part (encoding in us-ascii) doesn't seem to be necessary in
my case, because the gio tool prints all non-ascii characters of the
symbolic link file name in the syntax I've shown.
Thanks, and best regards, Michael.
next prev parent reply other threads:[~2018-05-08 12:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.13544.1525773753.27995.help-gnu-emacs@gnu.org>
2018-05-08 11:00 ` Parsing of multibyte strings frpom process output Helmut Eller
2018-05-08 12:01 ` Michael Albinus
2018-05-08 12:21 ` Noam Postavsky
2018-05-08 12:47 ` Michael Albinus [this message]
2018-05-08 10:02 Michael Albinus
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87po2671rm.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=eller.helmut@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=npostavs@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).