From: Bruno Barbier <brubar.cs@gmail.com>
To: Jens Lechtenboerger <lechten@wi.uni-muenster.de>
Cc: Ihor Radchenko <yantar92@posteo.net>, emacs-orgmode@gnu.org
Subject: Re: Unicode problem with export of literal contents
Date: Mon, 20 Feb 2023 20:00:24 +0100 [thread overview]
Message-ID: <63f3c34b.1c0a0220.56de7.422e@mx.google.com> (raw)
In-Reply-To: <87sff0skuf.fsf@wi.uni-muenster.de>
Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:
> On 2023-02-20, Bruno Barbier wrote:
>
> However, if I use insert-file-contents-literally with a unicode
> file, I do *not* have to set the coding-system-for-write. This just
> works:
>
> (with-temp-buffer
> (insert-file-contents-literally "~/unicode.org")
> (secure-hash 'md5 (current-buffer)))
Humm. Emacs is amazing: it managed to guess the right encoding, from the
buffer context, probably...
But, what you are giving to 'org-export-string-as' is not the buffer,
it's a string. So, let's try the same without using an org function:
(with-temp-buffer
(insert (with-temp-buffer
(insert-file-contents-literally "~/unicode.org")
(buffer-string)))
(secure-hash 'md5 (current-buffer)))
And, that fails, requesting an encoding.
> In the context of Org export, secure-hash seems to require a coding
> system. Why?
I'm not an expert, so, you'll need to confirm with other sources. But
secure-hash requires an encoding in all cases, to compute the hash of
some text, because it needs the array of bytes that represents that text
to compute its hash.
I don't see any bug in org, and, I don't see any bug in secure-hash either.
You literally shoud stop using "literally" ;-)
And, you might want to read:
(info "(elisp) Non-ASCII Characters")
Bruno
>
> Best wishes
> Jens
next prev parent reply other threads:[~2023-02-20 19:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-16 10:46 Unicode problem with export of literal contents Jens Lechtenboerger
2023-02-17 5:51 ` Bruno Barbier
2023-02-17 7:48 ` Jens Lechtenboerger
2023-02-17 17:30 ` Bruno Barbier
2023-02-17 11:02 ` Ihor Radchenko
2023-02-17 16:56 ` Jens Lechtenboerger
2023-02-17 17:23 ` Bruno Barbier
2023-02-20 9:18 ` Jens Lechtenboerger
2023-02-20 9:40 ` Bruno Barbier
2023-02-20 10:16 ` Jens Lechtenboerger
2023-02-20 19:00 ` Bruno Barbier [this message]
2023-02-21 8:30 ` Jens Lechtenboerger
2023-02-17 18:22 ` Ihor Radchenko
2023-02-20 9:28 ` Jens Lechtenboerger
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63f3c34b.1c0a0220.56de7.422e@mx.google.com \
--to=brubar.cs@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=lechten@wi.uni-muenster.de \
--cc=yantar92@posteo.net \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).