[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [h-e-w] Processing chars above \200
From: |
Eli Zaretskii |
Subject: |
Re: [h-e-w] Processing chars above \200 |
Date: |
Sun, 23 Sep 2018 23:03:29 +0300 |
> Date: Sun, 23 Sep 2018 15:26:08 -0400
> From: John J. Xenakis <address@hidden>
> Cc: address@hidden
>
> > But in any case, there are commands to fix those errors right
> > away, as soon as you realize something like that happens. We will
> > get to that, once I understand more about the problem.
>
> Could you tell me what those commands are?
"C-x RET r" is the most important one. It prompts you for an encoding
(with completion), and then re-visits the file using that encoding.
> By the way, how do I encode that keyboard string in Lisp? How does
> one use "(universal-coding-system-argument CODING-SYSTEM)" in a macro?
In a macro, you just type "C-x RET c WHATEVER". In Lisp, you need to
let-bind coding-system-for-read to the appropriate coding-system
symbol, like this:
(let ((coding-system-for-read 'windows-1250))
(do-something))
> OK, you can download the following:
>
> http://jxenakis.com/gdgraphics/irbk-eeee-180923.zip
>
> The enclosed .txt file causes all the issues that I've described.
This file has 2 problems:
. It includes a null byte. When Emacs sees a null byte, it treats
the file as binary, and in particular inhibits decoding it. If
you need to work with such files, you can set
inhibit-null-byte-detection to t. But it is best to just delete
such bytes and then re-visit the file, because I doubt that you
need them there, they probably got there due to some snafu.
. Few of the non-ASCII characters in the file cannot be encoded by
your locale's default encoding. What does the following command
display in "emacs -Q":
M-: (default-value 'buffer-file-coding-system) RET
I'm guessing it says something like iso-latin-1-dos, and that
encoding cannot decode characters whose codes are between \200 and
\237. If that is the case, the following setting in your .emacs
should solve these problems:
(prefer-coding-system 'windows-1252)
> To make is easy for you to find some of the 8-bit characters causing
> the problems, I inserted the string ">>>" in front of four lines
> containing them.
Thanks, but there's no need, it's easy to use this trick:
M-: (skip-chars-forward "\000-\177") RET