[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: stealing a code snippet



Thanks for taking a second look at this. It became the subject of some
discussion on the emacs-devel list. See below.

On 2020-11-09 08:29, Katsumi Yamaoka wrote:
> `detect-coding-region' does it by analogy, so the result will
> not necessarily be correct
> ...
> Therefore, as for `url-unhex-string', the coding system used to
> decode the result has to be given by the one that creates the
> encoded bytes (web site?).  eww does so, and so emacs-w3m does.

After the discussion on the emacs-devel list, I'm currently using the following,
without a need to temporarily move data to a temporary buffer:

 (decode-coding-string
   (url-unhex-string str)
     (or file-name-coding-system
         default-file-name-coding-system))

Does this work properly for the common Japanese use-cases? If so, it
might be a worthwhile modification for the sake of simplicity and
uniformity.

Note: I fell into a trap, in that...

  (default-value file-name-coding-system) => nil
         default-file-name-coding-system  => utf-8-unix

As of now, it seems that the emacs developers don't consider that a bug
or undesirable; the feeling seems to be that it's the burden of a
programmer to remember that idiom must always be

     (or file-name-coding-system
         default-file-name-coding-system)

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0