[Top][All Lists]

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

Re: unibyte<->multibyte conversion [Re: Emacs-diffs Digest, Vol 2, Issue

From: Kenichi Handa
Subject: Re: unibyte<->multibyte conversion [Re: Emacs-diffs Digest, Vol 2, Issue 28]
Date: Tue, 21 Jan 2003 09:20:49 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, "Stefan Monnier" <monnier+gnu/address@hidden> 
> While we're at it, how about making string-as-multibyte obsolete ?
> It's not used much and it has been abused many times in the past.

It is useful for instance in this scenario.  I don't
remember a concrete example, but some package is doing this
kind of thing.

Read a file of weird encoding in a unibyte buffer.  Parse
the contents and do decode-coding-region one bunch by one
with different coding systems.  Extract some part from that
unibyte buffer and insert it in a mulitbyte buffer.   The
last step is:
   (let ((str (buffer-substring FROM TO)))
       (set-buffer MULTIBYTE-BUF)
       (insert (string-as-multibyte str))))

> Also, I believe it's more or less equivalent to

>   (decode-coding-string str 'emacs-mule)

Yes, for the moment.   But, in emacs-unicode, we must change
it to:
        (decode-coding-string str 'utf-8-emacs)
On the other hand, we don't have to change a code using

Ken'ichi HANDA

reply via email to

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