all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Pittman <daniel@rimspace.net>
Subject: Re: reading binary, non-unix file
Date: Tue, 26 Oct 2004 11:08:48 +1000	[thread overview]
Message-ID: <87wtxe8evz.fsf@enki.rimspace.net> (raw)
In-Reply-To: clje4v$4c6$1@quimby.gnus.org

On 26 Oct 2004, Mickey Ferguson wrote:
> We're almost there. I don't have a single UTF-16 coding choice. When I
> tried what you provided, I saw:
>
> Possible completions are:
> utf-16-be                          utf-16-be-dos
> utf-16-be-mac                      utf-16-be-unix
> utf-16-le                          utf-16-le-dos
> utf-16-le-mac                      utf-16-le-unix
>
> I chose utf-16-le and it seemed to do it properly. I just don't know if
> that was the right choice - I don't fully understand what each of these
> provides.

They can be read as three section:  'utf-16', which is the 16 bit
version of Unicode, 'be' or 'le', which stand for big-endian or
little-endian, and 'mac', 'dos', or 'unix', which indicate line ending
conversion.

UTF-16 is the only coding system to posses the be/le split, and that is
because Microsoft unilaterally declared that they would be implementing
UTF-16-le in their OS, regardless of what the IETF and Unicode people
decided as an endian encoding.

The 'line ending' stuff is, basically, what line endings to expect/use
when you hit return.  -unix is LF, -mac is CR, and -dos is CRLF, through
quirks of historic accident, mostly.

> Second, after I determine which one of the above to use, can anyone help me
> to write a function so that I can then map a key combination (similar to C-X
> C-F uses Find-File), that will load in the proper coding and then find the
> file?  I'm lisp-impaired, so any help would be appreciated.  I'm capable of
> taking an interactive function that's been defined and mapping it to a
> keystroke, but that's about it.

    C-x RET c <coding system> <whatever command>

C-x RET c runs `universal-coding-system-argument', which allows you to
specify the encoding for the next command.

Alternately, you can from `file-coding-system-alist', which maps regular
expressions to coding systems automatically.

You can use that to specify that whatever filename you want is loaded as
whatever coding system you want.

Regards,
        Daniel
-- 
Estne Tibi Forte Magna Feles Fulva Et Planissima?

  reply	other threads:[~2004-10-26  1:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-22 18:47 reading binary, non-unix file Mickey Ferguson
2004-10-22 19:27 ` J. David Boyd
     [not found] ` <mailman.4677.1098473798.2017.help-gnu-emacs@gnu.org>
2004-10-22 19:57   ` Mickey Ferguson
2004-10-25  6:40     ` Mathias Dahl
2004-10-25 17:48       ` Mickey Ferguson
2004-10-26  1:08         ` Daniel Pittman [this message]
2004-10-26  9:05         ` Mathias Dahl
2004-10-26 17:00           ` Mickey Ferguson
2004-10-27  7:46             ` Mathias Dahl
2004-10-27 16:20               ` Mickey Ferguson
2004-10-27 16:39                 ` Reiner Steib
2004-10-27 16:41                 ` Drew Adams
2004-10-25 21:43       ` Mickey Ferguson
2004-10-25 23:55         ` Kevin Rodgers
2004-10-23  3:44 ` Daniel Pittman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wtxe8evz.fsf@enki.rimspace.net \
    --to=daniel@rimspace.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 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.