help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: reading binary, non-unix file


From: Daniel Pittman
Subject: Re: reading binary, non-unix file
Date: Tue, 26 Oct 2004 11:08:48 +1000
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]