[Top][All Lists]

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

decode-coding-string on invalid UTF-8 string isn't rejected

From: Simon Josefsson
Subject: decode-coding-string on invalid UTF-8 string isn't rejected
Date: Fri, 07 Mar 2003 21:05:39 +0100
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50 (gnu/linux)

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the address@hidden mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I'm trying to use decode-coding-string to "guess" charsets, and
noticed this:

(decode-coding-string "r\xe4k" 'latin-1)
 => "räk"
(decode-coding-string "r\xe4k" 'utf-8)
 => "r"

Wouldn't it be more appropriate if it returned nil (like
`decode-char') or "rk"?

Perhaps I'm looking in the wrong place though.  Is there a elisp
function that takes a unibyte string and decodes it using whatever the
default (process) coding system priorities may be?  I.e., for me that
runs in a UTF-8 locale, first try decoding as utf-8, if it fails,
continue with Latin-1, etc.

In GNU Emacs (i686-pc-linux-gnu)
 of 2003-03-07 on latte.josefsson.org
configured using `configure '--with-gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: en_US.UTF-8
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Recent input:
<up> <left> <M-left> <M-left> <M-left> <right> C-d 
\ x e 4 C-e C-j <up> <left> <M-left> <M-left> M-d M-d 
l a t i n - 1 C-e C-j <up> <M-left> <M-left> M-d M-d 
u t f - 8 C-e C-j C-x o C-x k <return> n p p q m e 
m a c s - d e v e l @ e m a c s . o r g <M-left> <M-left> 
M-d g n u <down> C-h f <up> <up> <return> <down> <down> 
C-x k <return> y e s <return> M-x r e p o r <tab> 

Recent messages:
Entering debugger...
Back to top level.
Mark set
Mark activated
Mark set
Type C-x 1 to remove help window.  C-M-v to scroll the help.
Loading emacsbug...done

reply via email to

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