all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How does one disable (UTF-8?) input "fixup"?
@ 2016-01-11 10:16 Winston
  2016-01-11 15:49 ` Eli Zaretskii
       [not found] ` <mailman.2153.1452527358.843.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Winston @ 2016-01-11 10:16 UTC (permalink / raw)
  To: help-gnu-emacs

What mode/variable controls text conversion/fixup when reading a file?

I have a mostly ASCII text file that contains a few stray non-ASCII
characters.

When the file is named "foo", doing "emacs foo" and searching shows
that the non-ASCII characters have been changed (from, for example,
\342\200\246 to \u7AB6\uFF66).

However, if I rename the file "foo.exe", do "emacs foo.exe" and search,
I see the original characters (no change).

In both cases, the mode showed (Fundamental).

Curiously, after "emacs foo.exe", I did find-file-other-window to read
in "foo", and the characters were NOT altered.

What controls whether that conversion is done or not?  Is there an easy
way to turn it on/off?  I didn't see anything in the results from
apropos "-mode" that looked relevant.

Thanks in advance,
 -WBE


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How does one disable (UTF-8?) input "fixup"?
  2016-01-11 10:16 How does one disable (UTF-8?) input "fixup"? Winston
@ 2016-01-11 15:49 ` Eli Zaretskii
       [not found] ` <mailman.2153.1452527358.843.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2016-01-11 15:49 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Winston <wbe@UBEBLOCK.psr.com.invalid>
> Date: Mon, 11 Jan 2016 05:16:13 -0500
> 
> What mode/variable controls text conversion/fixup when reading a file?
> 
> I have a mostly ASCII text file that contains a few stray non-ASCII
> characters.

You need to prefix "C-x C-f" with "C-x RET c us-ascii RET".  See the
node "Text Coding" in the Emacs manual.

Or use "M-x find-file-literally" to disable any conversions.

> However, if I rename the file "foo.exe", do "emacs foo.exe" and search,
> I see the original characters (no change).

Emacs by default visits binary files without any conversions.

> Curiously, after "emacs foo.exe", I did find-file-other-window to read
> in "foo", and the characters were NOT altered.

Because the file is already in an Emacs buffer, so Emacs doesn't
re-read it, it just reuses that buffer's contents.

> What controls whether that conversion is done or not?  Is there an easy
> way to turn it on/off?  I didn't see anything in the results from
> apropos "-mode" that looked relevant.

Text decoding is not a mode, it is a basic feature of any I/O Emacs
does.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How does one disable (UTF-8?) input "fixup"?
       [not found] ` <mailman.2153.1452527358.843.help-gnu-emacs@gnu.org>
@ 2016-01-12  7:51   ` Winston
  0 siblings, 0 replies; 3+ messages in thread
From: Winston @ 2016-01-12  7:51 UTC (permalink / raw)
  To: help-gnu-emacs

I originally asked:
>> What mode/variable controls text conversion/fixup when reading a file?

>> I have a mostly ASCII text file that contains a few stray non-ASCII
>> characters.

Eli Zaretskii <eliz@gnu.org> kindly replied:
> You need to prefix "C-x C-f" with "C-x RET c us-ascii RET".  See the
> node "Text Coding" in the Emacs manual.

> Or use "M-x find-file-literally" to disable any conversions.

Ah.  OK.  Thanks!

>> However, if I rename the file "foo.exe", do "emacs foo.exe" and
>> search, I see the original characters (no change).

> Emacs by default visits binary files without any conversions.

...which is what I expected and had been used to, and why I tried
renaming the file "foo.exe" as a work-around to prevent the conversions.
:-)

>> Curiously, after "emacs foo.exe", I did find-file-other-window to
>> read in "foo", and the characters were NOT altered.

> Because the file is already in an Emacs buffer, so Emacs doesn't
> re-read it, it just reuses that buffer's contents.

You appear to be referring to this feature of find-file-literally:

    "You cannot absolutely rely on this function to result in
     visiting the file literally.  If Emacs already has a buffer
     which is visiting the file, you get the existing buffer,
     regardless of whether it was created literally or not."

However, that wasn't the case I described.  I had identical content in
two separate disk files ("foo" and "foo.exe").  The files were not
linked (hard or symbolic).  [Think "bar" instead of "foo" if that
helps.]  I started emacs with "emacs foo.exe".  "foo" was not in any
Emacs buffer at that point.  I then used find-file-other-window to read
"foo".  That created a second buffer to hold "foo".  Although the
contents happened to be identical, from Emacs's standpoint, they were
two separate files in two separate buffers.  I was surprised that
character conversions upon reading "foo" as the second file into a
second buffer were in any way affected by having read some other file
into another buffer before it.

No matter...  You answered my question about how to prevent the
conversions without having to rename the file.  Thanks!
 -WBE


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-12  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 10:16 How does one disable (UTF-8?) input "fixup"? Winston
2016-01-11 15:49 ` Eli Zaretskii
     [not found] ` <mailman.2153.1452527358.843.help-gnu-emacs@gnu.org>
2016-01-12  7:51   ` Winston

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.