all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* replacing characters and whacky trans-buffer conversion
@ 2007-03-06 15:15 ken
  2007-03-06 16:28 ` Peter Dyballa
  2007-03-07 20:48 ` ken
  0 siblings, 2 replies; 34+ messages in thread
From: ken @ 2007-03-06 15:15 UTC (permalink / raw)
  To: GNU Emacs List


An email comes in with this (emdash) character in it: –

It looks like an em-dash until the text containing it is pasted into an
emacs buffer; then it appears as a series of "garbage characters".
(Copy and paste the emdash into an emacs buffer yourself, and perhaps
you'll see what I mean.)

To me and, possibly to you, this emdash appears in emacs as nine (9)
"garbage" characters.

Because I want to programmatically replace these 9 garbage characters
into something latin1-friendly, I copy-and-paste these nine characters
into an *.el file containing a line like this:

  (replace-string "–" "--" nil (point-min) (point-max))

The sought string (i.e., the first argument above) isn't found, however
because, for some whacky reason, the emdash pasted into the *.el file is
different-- by one character-- from exactly the same emdash pasted into
the other emacs buffer (the one I'm saving the email in).

In the emacs buffer containing the email, the fourth garbage character
(as shown by C-u C-x=) is:

  character: β (05542, 2914, 0xb62)
    charset: greek-iso8859-7
	     (Right-Hand Part of Latin/Greek Alphabet (ISO/IEC 8859-7): ISO-IR-126)
 code point: 98
     syntax: word
   category: g:Greek
buffer code: 0x86 0xE2
  file code: not encodable by coding system undecided-unix
       font: -ETL-Fixed-Medium-R-Normal--16-160-72-72-C-80-ISO8859-7

In the *.el buffer, the fourth garbage character (which should be
exactly the same character) is:

  character: â (0342, 226, 0xe2)
    charset: eight-bit-graphic (8-bit graphic char (0xA0..0xFF))
 code point: 226
     syntax: whitespace
   category:
buffer code: 0xE2
  file code: 0xE2 (encoded by coding system raw-text-unix)
       font: -ETL-Fixed-Medium-R-Normal--16-160-72-72-C-80-ISO8859-1

I tried entering "C-q 5542 RETURN" into the *.el file, but emacs
immediately makes it into the second (â, or 0342) character.  Doing the
same into the other emacs buffer (containing my copy of the email)
*does* enter the good (β, or 05542) character.

All I really want is for the above replace-string function to work as
expected.  But emacs consistently converts that fourth character in the
emdash string into a different character, subsequently causing the
search to fail.  So how do I get the correct "garbage" characters into
the first argument of the replace-string function-- i.e., into the *.el
file?


tnx,
ken


-- 
"Genius might be described as a supreme capacity for getting its
possessors into trouble of all kinds."
	-- Samuel Butler

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

end of thread, other threads:[~2007-03-10 19:12 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.528.1173194164.7795.help-gnu-emacs@gnu.org>
2007-03-06 16:41 ` replacing characters and whacky trans-buffer conversion Oliver Scholz
2007-03-06 17:52 ` Stefan Monnier
2007-03-06 15:15 ken
2007-03-06 16:28 ` Peter Dyballa
2007-03-07  7:38   ` Matthew Flaschen
2007-03-07  9:59     ` Peter Dyballa
2007-03-08 12:16   ` ken
2007-03-08 16:31     ` Peter Dyballa
2007-03-08 20:43   ` ken
2007-03-08 23:14     ` Peter Dyballa
     [not found]     ` <mailman.688.1173395790.7795.help-gnu-emacs@gnu.org>
2007-03-09 14:28       ` Oliver Scholz
2007-03-07 20:48 ` ken
2007-03-07 21:03   ` ken
2007-03-07 21:30     ` Peter Dyballa
2007-03-08  1:11       ` ken
     [not found]       ` <mailman.627.1173316331.7795.help-gnu-emacs@gnu.org>
2007-03-08  7:50         ` Stefan Monnier
2007-03-08 10:40           ` ken
2007-03-08 11:55             ` ken
     [not found]           ` <mailman.648.1173350436.7795.help-gnu-emacs@gnu.org>
2007-03-09  1:51             ` Stefan Monnier
2007-03-09 10:15               ` ken
2007-03-09 13:14                 ` Peter Dyballa
2007-03-09 15:54                   ` ken
2007-03-09 16:13                     ` Peter Dyballa
2007-03-09 18:41                   ` Reiner Steib
2007-03-10 18:29                     ` ken
2007-03-10 18:57                       ` Reiner Steib
2007-03-10 19:00                       ` Peter Dyballa
2007-03-10 19:12                       ` Eli Zaretskii
2007-03-09 10:21               ` ken
2007-03-09 13:02                 ` Peter Dyballa
     [not found]               ` <mailman.699.1173435731.7795.help-gnu-emacs@gnu.org>
2007-03-09 20:20                 ` Stefan Monnier
2007-03-10 18:32                   ` ken
     [not found]               ` <mailman.698.1173435330.7795.help-gnu-emacs@gnu.org>
2007-03-09 20:34                 ` Stefan Monnier
2007-03-09 22:00                   ` Oliver Scholz

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.