GNU Emacs: nXML mode and code pages
Posted by Dimitar Panayotov on 29 November 2006, 1:31
I have noticed some time ago, that nXML mode has problems with encoding names specified in the mandatory XML prolog, namely this one:
<?xml version = ‘1.0‘ encoding = ‘utf-8‘?>
And so, when one types windows-1251 (or opens XML file whose prolog is such), nXML puts this message in the status bar:
Unsupported encoding
Even worse, it refuses to save the XML, since it persists in its intention to save the file in the proper encoding, which is good. But this “unsupported encoding” thing is not quite true. It’s just that GNU Emacs does not “know” of such name in its codepage names list. You need to explicitly tell it what exactly do you mean by windows-1251 and everything is good. Put this in your “.emacs” file:
(codepage-setup 1251)
(coding-system-put ‘cp1251 ‘mime-charset ‘windows-1251)
So, what’s this? Well, GNU Emacs knows about “cpNNNN” code pages and uses them; note that it also needs to explicitly load them, too (not very smart, I think). Why it uses such charset names, I am not sure, since IANA charset registry says that windows-1251 is the only name of this encoding and no official aliases exist.
Of course, it is possible that GNU Emacs was the first one to handle multiple charsets than the IANA agency, and in absence of official and standard names, it used its own. I do not know.
These “125x” encodings are between 1250 and 1258. You may alias them all, if your underlying OS has support for them (and your fonts, too).
29 November 2006, 5:11 at 5:11
@Dimitar Panayotov:
In last month I have tried to install nXml for editing xhtml pages. But, it doesn’t work with mule.
Sad, but true. I’m using Emacs 21.4 with mule on Debian.
So, I’m waiting of Emacs 22 release to give it a try.
29 November 2006, 5:41 at 5:41
———
[English]
Roman,
I have studied this issue some time ago; I remember a lot of people have tried to use `nXML + mule-ucs’. I cannot remember everything right now, but the conclusion simply was:
“nXML does not work with mule-ucs.”
I personally use leim. I have never tried `mule-ucs’ and I really cannot tell the difference, but it works well enough for me.
I am not 100% sure that this cannot be done, it’s just that I have never tried to do this.
———
[Russian]
Роман, я очитал статии твоим проблема и я увидел что некакие Эмакс юзери сказали: nXML не работает совместно с mule-ucs. У меня `leim’ и для мне это хорошо, но я не могу сказать какая чем разница помежду `mule-ucs’ и `leim’.
Я не очень много убеден, что это невозможно, но я никогда пытался сделать эта операция.