emacs-pretest-bug
[Top][All Lists]
Advanced

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

(format "%c" ... ) sometimes returns multibyte chars when unibyte expect


From: Nils Klarlund
Subject: (format "%c" ... ) sometimes returns multibyte chars when unibyte expected (?)
Date: Sun, 22 Aug 2004 18:59:10 -0400

Greetings,

In order to format a positive integer as a string (of four bytes), one
might expect to use the "format" function.  At least, this is what is
done presently in vr-mode (that connects Emacs to NaturallySpeaking)
[the function is enclosed below, not that it is really important). 

But the behavior of "format" seems erroneous or at least
unpredictable.  For example, sometimes 169 becomes a unibyte,
sometimes a multiplebyte character (using the very latest cvs version
I could check out):

  (aref (format "%c" 169) 0) --> 169
  (aref (format "%c%c" 0 169) 1) --> 2217

/Nils

--------------------------------------------------------

(defun vr-etonl (i)
  (format "%c%c%c%c"
          (lsh (logand i 4278190080) -24)
          (lsh (logand i 16711680) -16)
          (lsh (logand i 65280) -8)
          (logand i 255)))

In GNU Emacs 21.3.50.1 (i386-msvc-nt5.1.2600)
 of 2003-10-15 on GREMLIN-AMD
configured using `configure --with-msvc (12.00)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  cua-mode: t
  show-paren-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  line-number-mode: t
  transient-mark-mode: t





reply via email to

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