[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [h-e-w] Saving in utf-16-le encoding
From: |
PaulBowman |
Subject: |
RE: [h-e-w] Saving in utf-16-le encoding |
Date: |
Wed, 21 Sep 2005 11:00:07 +0100 |
James,
This works well for me. Thanks for your help.
cheers,
Paul
> -----Original Message-----
> From: James Todd [mailto:address@hidden
> Sent: 20 September 2005 18:28
> To: Bowman, Paul (HBOS Group Technology); address@hidden
> Subject: RE: [h-e-w] Saving in utf-16-le encoding
>
>
> I've seen this problem too. The utf-16-le-pre-write-conversion and
> utf-16-be-pre-write-conversion functions don't actually seem to be
> defined by default. I got around this by defining empty functions, and
> also by setting the 'auto-coding-regexp-alist to
> automatically recognize
> both LE and BE utf-16 files. I've the relevant elisp code below.
>
> HTH,
> James
>
> ;; Make emacs recognize a double byte utf-16 unicode file, which is
> ;; the unicode text file time commonly used under windows. We do this
> ;; by looking for the 4 byte marker (called 'BOM') at the start of the
> ;; file, which also indicates either big or little endian. "^\377\376"
> ;; is FFFE in octal.
> (add-to-list 'auto-coding-regexp-alist '("^\377\376" . utf-16-le) t)
> (add-to-list 'auto-coding-regexp-alist '("^\376\377" . utf-16-be) t)
>
> ;; The utf-16-le-pre-write-conversion function is called whenever
> ;; we're saving out a utf-16 text file. For some reason the function
> ;; doesn't exist in the distribution emacs files, so we define our
> ;; own.
> (defun utf-16-le-pre-write-conversion (start end)
> nil
> )
>
> (defun utf-16-be-pre-write-conversion (start end)
> nil
> )
> <SNIP>
--
------------------------------------------------------------------------------
HBOS plc, Registered in Scotland No. SC218813. Registered Office: The Mound,
Edinburgh EH1 1YZ. HBOS plc is a holding company, subsidiaries of which are
authorised and regulated by the Financial Services Authority.
==============================================================================