help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: decode-coding-string question


From: Eli Zaretskii
Subject: Re: decode-coding-string question
Date: Fri, 15 Aug 2008 10:37:59 +0300

> From: Dmitry Dzhus <address@hidden>
> Date: Fri, 15 Aug 2008 02:19:11 +0400
> 
> Ted Zlatanov wrote:
> 
> > This should decode to нуль but doesn't (I get the same string instead):
> >
> > (decode-coding-string "íîëü" 'cp1251)
> >
> > Am I missing something obvious?  Do I need to encode the string to
> > something else?
> 
> 0. «íóëü», not «íîëü»

That's not important, the original problem remains, even with a
different spelling of the word.

> 1. (decode-coding-string (string-make-unibyte "íóëü") 'cp1251)

Yes, that's it: decode-coding-string works reliably only on unibyte
strings.  In multibyte strings, random byte values will be interpreted
according to rules that are appropriate for Emacs internal
representation of text in buffers and strings, not according to what
we humans expect.





reply via email to

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