[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fixing M$ character codes
From: |
Jym Dyer |
Subject: |
Re: fixing M$ character codes |
Date: |
03 Jul 2004 21:27:23 -0700 |
=v= I think ideally the code would parse headers to figure out
whether the brain damaged quotes are supposed to be ISO-Latin,
Windows-1252, UTF-8, or whatever. But for now I just use a
sledge hammer and covert any and all needlessly-8bit characters
to their 7bit equivalents.
=v= The code I use is below. I suppose someday I ought to make
them more comprehensive, but for now I just add what I need
along the way.
<_Jym_>
(defun jym.de8 ()
"Turn 8bit characters into 7bit equivalents."
(interactive)
(mapcar
(function (lambda (old_and_new)
(save-excursion (apply 'query-replace old_and_new))))
'(("" "-")
("¹" "'")
("²" "''")
("³" "``")
("·" "*")
("
" "...")
("" "--")
("" "`")
("" "`")
("" "``") ; = 0x93
("" "''") ; = 0x94
("" "*")
("" "-") ; = 0x96
("" "--") ; = 0x97
("" "`")
("" "'")
("" "``")
("" "''")
("â" "") )))
;mapcar;
;defun jym.de8;
(defun jym.de8qp ()
"Turn quoted printable 8bit into 7bit equivalents."
(interactive)
(mapcar
(function (lambda (old_and_new)
(save-excursion (apply 'query-replace old_and_new))))
'(("=\n" "")
;("=E2=80=94" "--")
("=E2=80=99" "'") ; UTF-8
("=E2=80=9C" "``") ; UTF-8
("=E2=80=9D" "''") ; UTF-8
("=0D\n" "\n") ; = \r\n
("=20\n" "\n")
("=2E" ".")
("=3F" "?")
("=46" "F")
("=5B" "[")
("=5D" "]")
("=8B" "--")
("=8C" "`")
("=91" "`")
("=92" "'")
("=93" "``") ; = 0223
("=94" "''")
("=96" "-") ; = 0226
("=97" "--") ; = 0227
("=A0" " ")
("=A5" "'")
("=AD" "--")
("=AE" "\"")
("=B2" "``")
("=B3" "''")
("=B9" "'")) ))
;mapcar;
Re: fixing M$ character codes, Jesper Harder, 2004/07/04
Re: fixing M$ character codes, nospam55, 2004/07/05