all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ken <gebser@speakeasy.net>
To: help-gnu-emacs@gnu.org
Subject: Re: How to get rid of Microsoft dumb quotes, e.g. \222 for apostrophe?
Date: Sat, 17 Feb 2007 06:04:52 -0500	[thread overview]
Message-ID: <45D6E154.8040706@speakeasy.net> (raw)
In-Reply-To: <87hctmgjur.fsf@patagonia.sebmags.homelinux.org>


On 02/16/2007 11:14 AM somebody named Sebastian P. Luque wrote:
> On Fri, 16 Feb 2007 11:02:23 -0500,
> ken <gebser@speakeasy.net> wrote:
> 
> [...]
> 
>> This allows, or should allow, the binding of the function to a key
>> chord.  But something is not right.  Can anyone tell where the problem
>> is.  Running this function I get no errors, but the garbage/mschars are
>> not replaced.
> 
> I can't tell what is wrong with that code, but I've solved those issues
> with this (I lost track where I stole this from):
> 
> 
> (standard-display-ascii ?\200 (vector (decode-char 'ucs #x253c)))
> (standard-display-ascii ?\201 (vector (decode-char 'ucs #x251c)))
> (standard-display-ascii ?\202 (vector (decode-char 'ucs #x252c)))
> (standard-display-ascii ?\203 (vector (decode-char 'ucs #x250c)))
> (standard-display-ascii ?\204 (vector (decode-char 'ucs #x2524)))
> (standard-display-ascii ?\205 (vector (decode-char 'ucs #x2502)))
> (standard-display-ascii ?\206 (vector (decode-char 'ucs #x2510)))
> (standard-display-ascii ?\210 (vector (decode-char 'ucs #x2534)))
> (standard-display-ascii ?\211 (vector (decode-char 'ucs #x2514)))
> (standard-display-ascii ?\212 (vector (decode-char 'ucs #x2500)))
> (standard-display-ascii ?\214 (vector (decode-char 'ucs #x2518)))
> (standard-display-ascii ?\220 [? ])
> (standard-display-ascii ?\221 [?\` ])
> (standard-display-ascii ?\222 [?\'])
> (standard-display-ascii ?\223 [?\"])
> (standard-display-ascii ?\224 [?\"])
> (standard-display-ascii ?\225 "* ")
> (standard-display-ascii ?\226 "--")
> (standard-display-ascii ?\227 " -- ")

Thanks, Seb.  As I understand this code (and, frankly, I don't totally),
it will handle single-character substrings only.  MS and other files
frequently contain multi-byte characters which appear in emacs as a
string of garbage characters.  (See example in my previous post.)
While of course it's best to write code which doesn't exceed the
capabilities of the programming language, it's pretty much a mark of a
mature programming language that it has the capability to
programmatically search-and-replace multi-byte strings in a file, even
should the sought- and replacement-strings be of different lengths.  In
fact, I made just this sort of function a homework assignment in my C
Programming 101 class many years ago.  So it's rather mystifying to me,
especially given the prevalence of the need for such functionality, that
such a trivial bit of programming is such a challenge in elisp.  Maybe
I'll take another run at it later.

Best,
ken

  reply	other threads:[~2007-02-17 11:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16 12:19 How to get rid of Microsoft dumb quotes, e.g. \222 for apostrophe? Endless Story
2007-02-16 12:44 ` Brendan Halpin
2007-02-16 16:02   ` ken
2007-02-16 16:14     ` Sebastian P. Luque
2007-02-17 11:04       ` ken [this message]
     [not found]   ` <mailman.4605.1171641752.2155.help-gnu-emacs@gnu.org>
2007-02-16 16:59     ` Brendan Halpin
2007-02-16 22:22       ` ken
2007-02-17  1:47   ` Stefan Monnier
2007-02-17 12:06     ` ken
     [not found]     ` <mailman.4653.1171713988.2155.help-gnu-emacs@gnu.org>
2007-02-17 17:29       ` Stefan Monnier
2007-02-19 14:17   ` ken
2007-02-19 16:28     ` Shanks N
2007-02-19 18:48       ` ken
     [not found]   ` <mailman.4721.1171894691.2155.help-gnu-emacs@gnu.org>
2007-02-20  2:00     ` Stefan Monnier
2007-02-20 10:45       ` ken
2007-02-20 10:56         ` Juanma Barranquero
2007-02-20 12:46           ` ken
2007-02-20 13:07             ` Juanma Barranquero
2007-02-21  9:29     ` Endless Story
2007-02-16 16:22 ` Stefan Monnier
2007-02-16 17:00   ` Endless Story
2007-02-16 22:00     ` Radamanthe

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=45D6E154.8040706@speakeasy.net \
    --to=gebser@speakeasy.net \
    --cc=help-gnu-emacs@gnu.org \
    /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.