* mime-charset determination
@ 2000-08-20 18:21 Andrei Elkin
2000-08-20 18:38 ` ShengHuo ZHU
0 siblings, 1 reply; 5+ messages in thread
From: Andrei Elkin @ 2000-08-20 18:21 UTC (permalink / raw)
Cc: bugs
Current (5.8.7 for me) version provides the definitions of
`mm-find-mime-charset-region','mm-mime-charset' that seems to be incorrect.
For example my C-h L RET gives:
Cyrillic-KOI8 language environment
Support for Cyrillic KOI8-R.
Sample text:
Russian (Русский) Здравствуйте!
Input methods (default, cyrillic-jcuken):
Character sets:
cyrillic-iso8859-5: ISO8859-5 (Cyrillic)
Coding systems:
cyrillic-koi8 (`R' in mode line):
KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)
(alias: koi8-r koi8)
And my evelope has
Content-Type: text/plain; charset=iso8859-5
insteed of my precious =koi8-r
If fact `mm-find-mime-charset-region','mm-mime-charset' try to find
out mime-charset value via `Character sets' one.
But should do it thru coding-system (as it said in mule.el).
Yes, my charset is cyrillic-iso8859-5. But
(coding-system-get
(mm-preferred-coding-system charset) 'mime-charset)
in 'mm-mime-charset' body get that wrong Content-Type as
`mm-prefer-coding-system' value is cyrillic-iso8859-5.
I found out that `select-message-coding-system' works correctly
(resulting with cyrillic-koi8). So the situation becomes nice for me
with a redefinition of
(defun mm-find-mime-charset-region (b e)
(let ((mime-charset
(coding-system-get (select-message-coding-system) 'mime-charset)))
(if (listp mime-charset) mime-charset (list mime-charset))))
that dont need for 'mm-mime-charset' at all.
Emacs ver GNU Emacs 20.5.1 (i386-redhat-linux-gnu, X toolkit)
of Tue Feb 22 2000 on porky.devel.redhat.com
is run on Linux kernel 2.2.14 in unibyte mode.
______________
Andrei.Elkin
P.S this message was posted with the new definition, so should have
Content-Type: text/plain; charset=koi8-r
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mime-charset determination
2000-08-20 18:21 mime-charset determination Andrei Elkin
@ 2000-08-20 18:38 ` ShengHuo ZHU
0 siblings, 0 replies; 5+ messages in thread
From: ShengHuo ZHU @ 2000-08-20 18:38 UTC (permalink / raw)
Cc: astro, bugs
Andrei Elkin <astro@sbor.ru> writes:
> Current (5.8.7 for me) version provides the definitions of
> `mm-find-mime-charset-region','mm-mime-charset' that seems to be incorrect.
>
> For example my C-h L RET gives:
>
> Cyrillic-KOI8 language environment
>
> Support for Cyrillic KOI8-R.
>
> Sample text:
> Russian (Русский) Здравствуйте!
>
[...]
> I found out that `select-message-coding-system' works correctly
> (resulting with cyrillic-koi8). So the situation becomes nice for me
> with a redefinition of
>
> (defun mm-find-mime-charset-region (b e)
> (let ((mime-charset
> (coding-system-get (select-message-coding-system) 'mime-charset)))
> (if (listp mime-charset) mime-charset (list mime-charset))))
>
> that dont need for 'mm-mime-charset' at all.
select-message-coding-system might not be the answer for all
situations, especially when a message contains characters in the
charset other than the default one.
Anyway, the solution for KOI8-R encoding is
(if (fboundp 'put-charset-property)
(put-charset-property 'cyrillic-iso8859-5
'preferred-coding-system 'koi8-r))
ShengHuo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mime-charset determination
2000-08-21 12:22 ` elkin
2000-08-21 13:29 ` Roman Belenov
@ 2000-08-21 18:43 ` Andrei Elkin
1 sibling, 0 replies; 5+ messages in thread
From: Andrei Elkin @ 2000-08-21 18:43 UTC (permalink / raw)
Cc: astro
Let me proceed with the subject because
some correction for my last post should be done.
I should underline here that my subject correspont to unibyte mode
with some language environment.
That's exactly my situation.
ShengHuo ZHU writes:
> > select-message-coding-system might not be the answer for all
> > situations, especially when a message contains characters in the
> > charset other than the default one.
[ ... ]
elkin@astro.spbu.ru writes:
> thanks, I've seen that. Nor we can deduce mime-charset with
> current-language-environment's coding-system's property.
Charset property analysis for unibyte mode don't get the true result
without a hint like
ShengHuo ZHU's:
> > Anyway, the solution for KOI8-R encoding is
> >
> > (if (fboundp 'put-charset-property)
> > (put-charset-property 'cyrillic-iso8859-5
> > 'preferred-coding-system 'koi8-r))
> >
So I propose small changes in `mm-find-mime-charset-region'
that don't require for charset property for the case of
(and (not (mm-multibyte-p)) (boundp current-language-environment))
Another part of the code is kept unchanged.
;; proposed definition
(defun mm-find-mime-charset-region (b e)
"Return the MIME charsets needed to encode the region between B and E."
(let ((charsets
(if (or (mm-multibyte-p)
(not (boundp 'current-language-environment)))
(mapcar 'mm-mime-charset
(delq 'ascii
(mm-find-charset-region b e)))
;; here we avoid calling to both `mm-find-charset-region'
;; and `mm-mime-charset'
(list (coding-system-get
(first (detect-coding-with-language-environment b e current-language-environment)) 'mime-charset)))))
(when (memq 'iso-2022-jp-2 charsets)
(setq charsets (delq 'iso-2022-jp charsets)))
(setq charsets (mm-delete-duplicates charsets))
(if (and (> (length charsets) 1)
(fboundp 'find-coding-systems-region)
(memq 'utf-8 (find-coding-systems-region b e)))
'(utf-8)
charsets)))
> IMHO most Linux cyrillic emacsers really preferred koi8-r.
> Would it better to change
> the default cons (at characters.el)
> (cyrillic-iso8859-5 . cyrillic-iso-8bit)
> to
> (cyrillic-iso8859-5 . cyrillic-koi8)
> according to your advice?
>
> Maybe such setting should be
> done at emacs building/configuration time (e.g thru locale variables value)?
Roman Belenov <rbelenov@my-deja.com> writes:
>>Linux is not the only system Emacs runs on. Other encodings like
>>cp1251 or cp866 may suit better for some people - and it doesn't
>>...
I mean that some configuration tools are able to detect depended
on whatever encoding value. E.g from locales that Linux have.
But that doesnt a matter if we do not need for
(put-charset-property 'cyrillic-iso8859-5
'preferred-coding-system 'koi8-r)
anymore (that is an example of configuration in gnus.info :)
______________
Andrei.Elkin
P.S
still i should get mime-charset=koi8r (КОИ8 :) in this message
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mime-charset determination
2000-08-21 12:22 ` elkin
@ 2000-08-21 13:29 ` Roman Belenov
2000-08-21 18:43 ` Andrei Elkin
1 sibling, 0 replies; 5+ messages in thread
From: Roman Belenov @ 2000-08-21 13:29 UTC (permalink / raw)
Cc: ding
Linux is not the only system Emacs runs on. Other encodings like
cp1251 or cp866 may suit better for some people - and it doesn't
depends upon OS only (I'm running Windows NT and still prefer
cyrillic-koi8 because it seems to affect mail/news only there koi8-r
is de-facto standard).
elkin@astro.spbu.ru writes:
> IMHO most Linux cyrillic emacsers really preferred koi8-r.
> Would it better to change
> the default cons (at characters.el)
> (cyrillic-iso8859-5 . cyrillic-iso-8bit)
> to
> (cyrillic-iso8859-5 . cyrillic-koi8)
> according to your advice?
>
> Maybe such setting should be
> done at emacs building/configuration time (e.g thru locale variables value)?
--
With regards, Roman.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mime-charset determination
[not found] <m37l9b2o5t.fsf@himmel.dune.ru>
@ 2000-08-21 12:22 ` elkin
2000-08-21 13:29 ` Roman Belenov
2000-08-21 18:43 ` Andrei Elkin
0 siblings, 2 replies; 5+ messages in thread
From: elkin @ 2000-08-21 12:22 UTC (permalink / raw)
Cc: astro
> select-message-coding-system might not be the answer for all
> situations, especially when a message contains characters in the
> charset other than the default one.
thanks, I've seen that. Nor we can deduce mime-charset with
current-language-environment's coding-system's property.
>
> Anyway, the solution for KOI8-R encoding is
>
> (if (fboundp 'put-charset-property)
> (put-charset-property 'cyrillic-iso8859-5
> 'preferred-coding-system 'koi8-r))
>
IMHO most Linux cyrillic emacsers really preferred koi8-r.
Would it better to change
the default cons (at characters.el)
(cyrillic-iso8859-5 . cyrillic-iso-8bit)
to
(cyrillic-iso8859-5 . cyrillic-koi8)
according to your advice?
Maybe such setting should be
done at emacs building/configuration time (e.g thru locale variables value)?
______________
Andrei.Elkin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2000-08-21 18:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-20 18:21 mime-charset determination Andrei Elkin
2000-08-20 18:38 ` ShengHuo ZHU
[not found] <m37l9b2o5t.fsf@himmel.dune.ru>
2000-08-21 12:22 ` elkin
2000-08-21 13:29 ` Roman Belenov
2000-08-21 18:43 ` Andrei Elkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).