unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* about xhtml-mode encoding problem
@ 2007-07-09 14:44 lu
  2007-07-09 15:31 ` Peter Dyballa
  0 siblings, 1 reply; 20+ messages in thread
From: lu @ 2007-07-09 14:44 UTC (permalink / raw)
  To: help-gnu-emacs

I use xhtml-mode to edit jsp file which is encoded by sjis.
while I save the file it become utf-8 even when I (Coding system for
saving file (default nil): sjis
I want to know How to solve this problem.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 14:44 about xhtml-mode encoding problem lu
@ 2007-07-09 15:31 ` Peter Dyballa
  2007-07-09 16:07   ` lu
                     ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Peter Dyballa @ 2007-07-09 15:31 UTC (permalink / raw)
  To: lu@luxdo.jp; +Cc: help-gnu-emacs


Am 09.07.2007 um 16:44 schrieb lu:

> I want to know How to solve this problem.

You might try to use (file) local variables in the first line(s) of  
the file that are a valid XHTML comment:

	<comment string> -*- coding: sjis;

or insert a

	(prefer-coding-system 'sjis)

into your ~/.emacs file. More elaborate would be (not sure whether it  
works)

	(modify-coding-system-alist 'file "\\.xhtml\\'" 'sjis)

or, which works for me with different values:

	(add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))

--
Greetings

   Pete

"A mathematician is a machine that turns coffee into theorems."

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 15:31 ` Peter Dyballa
@ 2007-07-09 16:07   ` lu
  2007-07-09 17:08     ` Lennart Borgman (gmail)
  2007-07-09 18:00     ` Peter Dyballa
  2007-07-09 16:12   ` about xhtml-mode " 呂 克
       [not found]   ` <mailman.3225.1183997250.32220.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 20+ messages in thread
From: lu @ 2007-07-09 16:07 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

I added these line in my .emacs.
(modify-coding-system-alist 'file "\\.jsp\\'" 'sjis)
(add-to-list 'file-coding-system-alist '("\\.jsp\\'" . sjis))
(add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
(prefer-coding-system 'sjis)

But I'm sorry to say all of them doesn't work.
when I save the file it become utf-8.
I'm using emacs 22 on linux and windows xp.

Peter Dyballa wrote:
>
> Am 09.07.2007 um 16:44 schrieb lu:
>
>> I want to know How to solve this problem.
>
> You might try to use (file) local variables in the first line(s) of 
> the file that are a valid XHTML comment:
>
>     <comment string> -*- coding: sjis;
>
> or insert a
>
>     (prefer-coding-system 'sjis)
>
> into your ~/.emacs file. More elaborate would be (not sure whether it 
> works)
>
>     (modify-coding-system-alist 'file "\\.xhtml\\'" 'sjis)
>
> or, which works for me with different values:
>
>     (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
>
> -- 
> Greetings
>
>   Pete
>
> "A mathematician is a machine that turns coffee into theorems."
>
>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 15:31 ` Peter Dyballa
  2007-07-09 16:07   ` lu
@ 2007-07-09 16:12   ` 呂 克
  2007-07-09 17:59     ` Lennart Borgman (gmail)
       [not found]   ` <mailman.3225.1183997250.32220.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 20+ messages in thread
From: 呂 克 @ 2007-07-09 16:12 UTC (permalink / raw)
  Cc: help-gnu-emacs

Sorry I had a mistake.
The problem is on  *nxhtml-mode*,not xhtml-mode.

I added these line in my .emacs.
load-file (concat plugin_path "/nxml/autostart.el"))
(setq auto-mode-alist (cons '("\\.jsp$" . nxhtml-mode)        
auto-mode-alist))
(setq auto-mode-alist (cons '("\\.asp$" . nxhtml-mode)        
auto-mode-alist))
(setq auto-mode-alist (cons '("\\.php$" . nxhtml-mode)        
auto-mode-alist))
(setq auto-mode-alist (cons '("\\.phtml$" . nxhtml-mode)      
auto-mode-alist))

(modify-coding-system-alist 'file "\\.jsp\\'" 'sjis)
(add-to-list 'file-coding-system-alist '("\\.jsp\\'" . sjis))
(add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
(prefer-coding-system 'sjis)

But I'm sorry to say all of them doesn't work.
when I save the file it become utf-8.
I'm using emacs 22 on linux and windows xp.



Peter Dyballa wrote:
>
> Am 09.07.2007 um 16:44 schrieb lu:
>
>> I want to know How to solve this problem.
>
> You might try to use (file) local variables in the first line(s) of 
> the file that are a valid XHTML comment:
>
>     <comment string> -*- coding: sjis;
>
> or insert a
>
>     (prefer-coding-system 'sjis)
>
> into your ~/.emacs file. More elaborate would be (not sure whether it 
> works)
>
>     (modify-coding-system-alist 'file "\\.xhtml\\'" 'sjis)
>
> or, which works for me with different values:
>
>     (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
>
> -- 
> Greetings
>
>   Pete
>
> "A mathematician is a machine that turns coffee into theorems."
>
>
>


-- 
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ラクスドウ 株式会社
呂 克(ロ コク)
〒103-0014 東京都中央区日本橋蛎殻町1-5-4 塩田ビル4F
HP: http://www.luxdo.co.jp
TEL:03-3249-3405  FAX:03-5641-1955
E-mail: lu@luxdo.co.jp
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
       [not found]   ` <mailman.3225.1183997250.32220.help-gnu-emacs@gnu.org>
@ 2007-07-09 16:41     ` B. T. Raven
  2007-07-09 23:29       ` lu
  0 siblings, 1 reply; 20+ messages in thread
From: B. T. Raven @ 2007-07-09 16:41 UTC (permalink / raw)
  To: help-gnu-emacs

lu@luxdo.jp wrote:
> I added these line in my .emacs.
> (modify-coding-system-alist 'file "\\.jsp\\'" 'sjis)
> (add-to-list 'file-coding-system-alist '("\\.jsp\\'" . sjis))
> (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
> (prefer-coding-system 'sjis)
> 
> But I'm sorry to say all of them doesn't work.
> when I save the file it become utf-8.
> I'm using emacs 22 on linux and windows xp.
> 
> Peter Dyballa wrote:
>>
>> Am 09.07.2007 um 16:44 schrieb lu:
>>
>>> I want to know How to solve this problem.
>>
>> You might try to use (file) local variables in the first line(s) of 
>> the file that are a valid XHTML comment:
>>
>>     <comment string> -*- coding: sjis;
>>
>> or insert a
>>
>>     (prefer-coding-system 'sjis)
>>
>> into your ~/.emacs file. More elaborate would be (not sure whether it 
>> works)
>>
>>     (modify-coding-system-alist 'file "\\.xhtml\\'" 'sjis)
>>
>> or, which works for me with different values:
>>
>>     (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
>>
>> -- 
>> Greetings
>>
>>   Pete
>>
>> "A mathematician is a machine that turns coffee into theorems."
>>
>>
>>
> 
> 
> 


What happens if you type C-x RET c sjis C-x C-w FILENAME? Does that save the 
file using the sjis coding system?

Ed

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 16:07   ` lu
@ 2007-07-09 17:08     ` Lennart Borgman (gmail)
  2007-07-09 18:00     ` Peter Dyballa
  1 sibling, 0 replies; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2007-07-09 17:08 UTC (permalink / raw)
  To: lu@luxdo.jp; +Cc: Peter Dyballa, help-gnu-emacs

lu@luxdo.jp wrote:
> I added these line in my .emacs.
> (modify-coding-system-alist 'file "\\.jsp\\'" 'sjis)
> (add-to-list 'file-coding-system-alist '("\\.jsp\\'" . sjis))
> (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
> (prefer-coding-system 'sjis)
> 
> But I'm sorry to say all of them doesn't work.
> when I save the file it become utf-8.
> I'm using emacs 22 on linux and windows xp.

Which one does not work?

What major modes do you use?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 16:12   ` about xhtml-mode " 呂 克
@ 2007-07-09 17:59     ` Lennart Borgman (gmail)
  2007-07-11 14:02       ` lu
  0 siblings, 1 reply; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2007-07-09 17:59 UTC (permalink / raw)
  To: 呂 克; +Cc: help-gnu-emacs

呂 克 wrote:
> Sorry I had a mistake.
> The problem is on  *nxhtml-mode*,not xhtml-mode.
> 
> I added these line in my .emacs.
> load-file (concat plugin_path "/nxml/autostart.el"))
> (setq auto-mode-alist (cons '("\\.jsp$" . nxhtml-mode)        
> auto-mode-alist))
> (setq auto-mode-alist (cons '("\\.asp$" . nxhtml-mode)        
> auto-mode-alist))
> (setq auto-mode-alist (cons '("\\.php$" . nxhtml-mode)        
> auto-mode-alist))
> (setq auto-mode-alist (cons '("\\.phtml$" . nxhtml-mode)      
> auto-mode-alist))
> 
> (modify-coding-system-alist 'file "\\.jsp\\'" 'sjis)
> (add-to-list 'file-coding-system-alist '("\\.jsp\\'" . sjis))
> (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
> (prefer-coding-system 'sjis)
> 
> But I'm sorry to say all of them doesn't work.
> when I save the file it become utf-8.
> I'm using emacs 22 on linux and windows xp.


Thanks, that was why I asked you which major modes you are using.

nxhtml-mode is derived from nxml-mode and I think it handles coding 
systems a bit differently. Look at write-contents-functions in the 
buffer. I think it contains nxml-prepare-to-save. That function tries to 
get the coding system to use from the XML header if the coding system 
has not been specified explicitly for the buffer through 
buffer-file-coding-system.

Is there an XML header in the buffer in your case? What coding system 
does it specify?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 16:07   ` lu
  2007-07-09 17:08     ` Lennart Borgman (gmail)
@ 2007-07-09 18:00     ` Peter Dyballa
  2007-07-09 23:26       ` lu
  2007-07-09 23:37       ` about nxhtml-mode " lu
  1 sibling, 2 replies; 20+ messages in thread
From: Peter Dyballa @ 2007-07-09 18:00 UTC (permalink / raw)
  To: lu; +Cc: help-gnu-emacs


Am 09.07.2007 um 18:07 schrieb lu:

> But I'm sorry to say all of them doesn't work.
> when I save the file it become utf-8.

What is the definition of file-coding-system-alist before you try to  
save the buffer? Have you checked that your file does not contain  
characters outside the allowed ascii, katakana-jisx0201, and japanese- 
jisx0208 sets? What happens when you open the file in sjis, i.e. C-x  
RET c sjis RET C-x C-f <your file name>? Do you see strange or  
inappropriate glyphs?

--
Greetings

   Pete

Atheism is a non prophet organization.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 18:00     ` Peter Dyballa
@ 2007-07-09 23:26       ` lu
  2007-07-09 23:37       ` about nxhtml-mode " lu
  1 sibling, 0 replies; 20+ messages in thread
From: lu @ 2007-07-09 23:26 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

Peter Dyballa wrote:
>
> Am 09.07.2007 um 18:07 schrieb lu:
>
>> But I'm sorry to say all of them doesn't work.
>> when I save the file it become utf-8.
>
> What is the definition of file-coding-system-alist before you try to 
> save the buffer? Have you checked that your file does not contain 
> characters outside the allowed ascii, katakana-jisx0201, and 
> japanese-jisx0208 sets? What happens when you open the file in sjis, 
> i.e. C-x RET c sjis RET C-x C-f <your file name>? Do you see strange 
> or inappropriate glyphs?
>
> -- 
> Greetings
>
>   Pete
>
> Atheism is a non prophet organization.
>
>
>
The file does not contain characters outside the allowed ascii, 
katakana-jisx0201, and japanese-jisx0208
because I can correctly save it on other mode(html-helper).
 >>What happens when you open the file in sjis, i.e. C-x RET c sjis RET 
C-x C-f <your file name>
The file saved correctly encoded by sjis.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 16:41     ` B. T. Raven
@ 2007-07-09 23:29       ` lu
  0 siblings, 0 replies; 20+ messages in thread
From: lu @ 2007-07-09 23:29 UTC (permalink / raw)
  To: B. T. Raven; +Cc: help-gnu-emacs

B. T. Raven wrote:
> lu@luxdo.jp wrote:
>> I added these line in my .emacs.
>> (modify-coding-system-alist 'file "\\.jsp\\'" 'sjis)
>> (add-to-list 'file-coding-system-alist '("\\.jsp\\'" . sjis))
>> (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
>> (prefer-coding-system 'sjis)
>>
>> But I'm sorry to say all of them doesn't work.
>> when I save the file it become utf-8.
>> I'm using emacs 22 on linux and windows xp.
>>
>> Peter Dyballa wrote:
>>>
>>> Am 09.07.2007 um 16:44 schrieb lu:
>>>
>>>> I want to know How to solve this problem.
>>>
>>> You might try to use (file) local variables in the first line(s) of 
>>> the file that are a valid XHTML comment:
>>>
>>>     <comment string> -*- coding: sjis;
>>>
>>> or insert a
>>>
>>>     (prefer-coding-system 'sjis)
>>>
>>> into your ~/.emacs file. More elaborate would be (not sure whether 
>>> it works)
>>>
>>>     (modify-coding-system-alist 'file "\\.xhtml\\'" 'sjis)
>>>
>>> or, which works for me with different values:
>>>
>>>     (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
>>>
>>> -- 
>>> Greetings
>>>
>>>   Pete
>>>
>>> "A mathematician is a machine that turns coffee into theorems."
>>>
>>>
>>>
>>
>>
>>
>
>
> What happens if you type C-x RET c sjis C-x C-w FILENAME? Does that 
> save the file using the sjis coding system?
>
> Ed
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>

 >>What happens if you type C-x RET c sjis C-x C-w FILENAME? Does that 
save the file using the sjis coding system?
The file corretly saved by sjis.
But when I type c-x c-s it become utf-8.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about nxhtml-mode encoding problem
  2007-07-09 18:00     ` Peter Dyballa
  2007-07-09 23:26       ` lu
@ 2007-07-09 23:37       ` lu
  2007-07-11 12:47         ` lu
  1 sibling, 1 reply; 20+ messages in thread
From: lu @ 2007-07-09 23:37 UTC (permalink / raw)
  Cc: help-gnu-emacs

I'm very sorry,I made a mistake.
The problem is only on *nxhtml-mode*.
so The title is confusing.I correct it.

Peter Dyballa wrote:
>
> Am 09.07.2007 um 18:07 schrieb lu:
>
>> But I'm sorry to say all of them doesn't work.
>> when I save the file it become utf-8.
>
> What is the definition of file-coding-system-alist before you try to 
> save the buffer? Have you checked that your file does not contain 
> characters outside the allowed ascii, katakana-jisx0201, and 
> japanese-jisx0208 sets? What happens when you open the file in sjis, 
> i.e. C-x RET c sjis RET C-x C-f <your file name>? Do you see strange 
> or inappropriate glyphs?
>
> -- 
> Greetings
>
>   Pete
>
> Atheism is a non prophet organization.
>
>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about nxhtml-mode encoding problem
  2007-07-09 23:37       ` about nxhtml-mode " lu
@ 2007-07-11 12:47         ` lu
  2007-07-11 13:18           ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 20+ messages in thread
From: lu @ 2007-07-11 12:47 UTC (permalink / raw)
  Cc: help-gnu-emacs

Hi,

I sovle the nxhtml encoding problem by add the following code.

;; Fix nhxtml save bug(error encoding)
(add-hook 'before-save-hook
          (lambda ()
              (setq coding-system-for-write buffer-file-coding-system)))

I think it is a bug in nxhtml.

lu@luxdo.jp wrote:
> I'm very sorry,I made a mistake.
> The problem is only on *nxhtml-mode*.
> so The title is confusing.I correct it.
>
> Peter Dyballa wrote:
>>
>> Am 09.07.2007 um 18:07 schrieb lu:
>>
>>> But I'm sorry to say all of them doesn't work.
>>> when I save the file it become utf-8.
>>
>> What is the definition of file-coding-system-alist before you try to 
>> save the buffer? Have you checked that your file does not contain 
>> characters outside the allowed ascii, katakana-jisx0201, and 
>> japanese-jisx0208 sets? What happens when you open the file in sjis, 
>> i.e. C-x RET c sjis RET C-x C-f <your file name>? Do you see strange 
>> or inappropriate glyphs?
>>
>> -- 
>> Greetings
>>
>>   Pete
>>
>> Atheism is a non prophet organization.
>>
>>
>>
>
>
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
> lu@luxdo.jp wrote:
>> I use xhtml-mode to edit jsp file which is encoded by sjis.
>> while I save the file it become utf-8 even when I (Coding system for
>> saving file (default nil): sjis
>> I want to know How to solve this problem.
>>
>>
>> _______________________________________________
>> help-gnu-emacs mailing list
>> help-gnu-emacs@gnu.org
>> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>>     

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about nxhtml-mode encoding problem
  2007-07-11 12:47         ` lu
@ 2007-07-11 13:18           ` Lennart Borgman (gmail)
  2007-07-11 14:07             ` lu
  2007-07-12 13:56             ` lu
  0 siblings, 2 replies; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2007-07-11 13:18 UTC (permalink / raw)
  To: lu@luxdo.jp; +Cc: help-gnu-emacs

Could you then please provide more information? (You did not answer my 
previous mail.)

Especially I would like to know how the xml header look.



lu@luxdo.jp wrote:
> Hi,
> 
> I sovle the nxhtml encoding problem by add the following code.
> 
> ;; Fix nhxtml save bug(error encoding)
> (add-hook 'before-save-hook
>          (lambda ()
>              (setq coding-system-for-write buffer-file-coding-system)))
> 
> I think it is a bug in nxhtml.
> 
> lu@luxdo.jp wrote:
>> I'm very sorry,I made a mistake.
>> The problem is only on *nxhtml-mode*.
>> so The title is confusing.I correct it.
>>
>> Peter Dyballa wrote:
>>>
>>> Am 09.07.2007 um 18:07 schrieb lu:
>>>
>>>> But I'm sorry to say all of them doesn't work.
>>>> when I save the file it become utf-8.
>>>
>>> What is the definition of file-coding-system-alist before you try to 
>>> save the buffer? Have you checked that your file does not contain 
>>> characters outside the allowed ascii, katakana-jisx0201, and 
>>> japanese-jisx0208 sets? What happens when you open the file in sjis, 
>>> i.e. C-x RET c sjis RET C-x C-f <your file name>? Do you see strange 
>>> or inappropriate glyphs?
>>>
>>> -- 
>>> Greetings
>>>
>>>   Pete
>>>
>>> Atheism is a non prophet organization.
>>>
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> help-gnu-emacs mailing list
>> help-gnu-emacs@gnu.org
>> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>>
>> lu@luxdo.jp wrote:
>>> I use xhtml-mode to edit jsp file which is encoded by sjis.
>>> while I save the file it become utf-8 even when I (Coding system for
>>> saving file (default nil): sjis
>>> I want to know How to solve this problem.
>>>
>>>
>>> _______________________________________________
>>> help-gnu-emacs mailing list
>>> help-gnu-emacs@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>>>     
> 
> 
> 
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-09 17:59     ` Lennart Borgman (gmail)
@ 2007-07-11 14:02       ` lu
  2007-07-11 14:41         ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 20+ messages in thread
From: lu @ 2007-07-11 14:02 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2103 bytes --]

Lennart Borgman (gmail) wrote:
> 呂 克 wrote:
>> Sorry I had a mistake.
>> The problem is on  *nxhtml-mode*,not xhtml-mode.
>>
>> I added these line in my .emacs.
>> load-file (concat plugin_path "/nxml/autostart.el"))
>> (setq auto-mode-alist (cons '("\\.jsp$" . nxhtml-mode)        
>> auto-mode-alist))
>> (setq auto-mode-alist (cons '("\\.asp$" . nxhtml-mode)        
>> auto-mode-alist))
>> (setq auto-mode-alist (cons '("\\.php$" . nxhtml-mode)        
>> auto-mode-alist))
>> (setq auto-mode-alist (cons '("\\.phtml$" . nxhtml-mode)      
>> auto-mode-alist))
>>
>> (modify-coding-system-alist 'file "\\.jsp\\'" 'sjis)
>> (add-to-list 'file-coding-system-alist '("\\.jsp\\'" . sjis))
>> (add-to-list 'file-coding-system-alist '("\\.xhtml\\'" . sjis))
>> (prefer-coding-system 'sjis)
>>
>> But I'm sorry to say all of them doesn't work.
>> when I save the file it become utf-8.
>> I'm using emacs 22 on linux and windows xp.
>
>
> Thanks, that was why I asked you which major modes you are using.
>
> nxhtml-mode is derived from nxml-mode and I think it handles coding 
> systems a bit differently. Look at write-contents-functions in the 
> buffer. I think it contains nxml-prepare-to-save. That function tries 
> to get the coding system to use from the XML header if the coding 
> system has not been specified explicitly for the buffer through 
> buffer-file-coding-system.
>
> Is there an XML header in the buffer in your case? What coding system 
> does it specify?
>
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>

I'm Sorry to reply late.
> Is there an XML header in the buffer in your case? What coding system 
> does it specify? 
I don't know what's the meaning.
There is a xml menu.but I don't  know What coding system does it specify?
Please see the attachment.
the first's file coding system is shift-jis(this is a s: at the left bottom)
but when I use C-x C-s,it because u: (utf)
I don't know why.






[-- Attachment #2: nxhtml2(after_save).png --]
[-- Type: image/png, Size: 106213 bytes --]

[-- Attachment #3: nxhtml1.png --]
[-- Type: image/png, Size: 109757 bytes --]

[-- Attachment #4: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about nxhtml-mode encoding problem
  2007-07-11 13:18           ` Lennart Borgman (gmail)
@ 2007-07-11 14:07             ` lu
  2007-07-12 13:56             ` lu
  1 sibling, 0 replies; 20+ messages in thread
From: lu @ 2007-07-11 14:07 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: help-gnu-emacs

Hi,
There's not any xml header in my jsp,
I just  sended the screenshot  by the previous mail.

Lennart Borgman (gmail) wrote:
> Could you then please provide more information? (You did not answer my 
> previous mail.)
>
> Especially I would like to know how the xml header look.
>
>
>
> lu@luxdo.jp wrote:
>> Hi,
>>
>> I sovle the nxhtml encoding problem by add the following code.
>>
>> ;; Fix nhxtml save bug(error encoding)
>> (add-hook 'before-save-hook
>>          (lambda ()
>>              (setq coding-system-for-write buffer-file-coding-system)))
>>
>> I think it is a bug in nxhtml.
>>
>> lu@luxdo.jp wrote:
>>> I'm very sorry,I made a mistake.
>>> The problem is only on *nxhtml-mode*.
>>> so The title is confusing.I correct it.
>>>
>>> Peter Dyballa wrote:
>>>>
>>>> Am 09.07.2007 um 18:07 schrieb lu:
>>>>
>>>>> But I'm sorry to say all of them doesn't work.
>>>>> when I save the file it become utf-8.
>>>>
>>>> What is the definition of file-coding-system-alist before you try 
>>>> to save the buffer? Have you checked that your file does not 
>>>> contain characters outside the allowed ascii, katakana-jisx0201, 
>>>> and japanese-jisx0208 sets? What happens when you open the file in 
>>>> sjis, i.e. C-x RET c sjis RET C-x C-f <your file name>? Do you see 
>>>> strange or inappropriate glyphs?
>>>>
>>>> -- 
>>>> Greetings
>>>>
>>>>   Pete
>>>>
>>>> Atheism is a non prophet organization.
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> help-gnu-emacs mailing list
>>> help-gnu-emacs@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>>>
>>> lu@luxdo.jp wrote:
>>>> I use xhtml-mode to edit jsp file which is encoded by sjis.
>>>> while I save the file it become utf-8 even when I (Coding system for
>>>> saving file (default nil): sjis
>>>> I want to know How to solve this problem.
>>>>
>>>>
>>>> _______________________________________________
>>>> help-gnu-emacs mailing list
>>>> help-gnu-emacs@gnu.org
>>>> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>>>>     
>>
>>
>>
>> _______________________________________________
>> help-gnu-emacs mailing list
>> help-gnu-emacs@gnu.org
>> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about xhtml-mode encoding problem
  2007-07-11 14:02       ` lu
@ 2007-07-11 14:41         ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2007-07-11 14:41 UTC (permalink / raw)
  To: lu@luxdo.jp; +Cc: help-gnu-emacs


lu@luxdo.jp wrote:
>> Thanks, that was why I asked you which major modes you are using.
>>
>> nxhtml-mode is derived from nxml-mode and I think it handles coding 
>> systems a bit differently. Look at write-contents-functions in the 
>> buffer. I think it contains nxml-prepare-to-save. That function tries 
>> to get the coding system to use from the XML header if the coding 
>> system has not been specified explicitly for the buffer through 
>> buffer-file-coding-system.
>>
>> Is there an XML header in the buffer in your case? What coding system 
>> does it specify?
 >
> I'm Sorry to reply late.

No problem, I just wondered if you noticed my reply.


>> Is there an XML header in the buffer in your case? What coding system 
>> does it specify? 
 >
> I don't know what's the meaning.

 From the pictures you sent me it looks like your pages are HTML, not 
XHTML. Is there any reason for you to use HTML instead of the new and in 
many ways better XHTML?

The header in XHTML could look something like this

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
           "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <title>News and Notes about nXhtml</title>
     <link href="wd/grapes/nxhtml-grapes.css" rel="StyleSheet" 
type="text/css" />
   </head>
   <body>

As you can see you can specify the encoding there. The corresponding 
Emacs encoding will be used when saving the file if you are using 
nxhtml-mode (or nxml-mode).

nxhtml-mode is for editing XHTML, not HTML. That is why have had some 
trouble here.


However the package (nXhtml) you download to get nxhtml-mode includes 
more than just nxhtml-mode. The part that is interesting for you is 
mumamo-mode which can handle JSP in both HTML and XHTML. If you have 
followed the installation instructions for nXhtml then mumamo-mode is 
used for this, but it assumes that the .jsp files are XHTML.

If you really want to use HTML then you could customize 
mumamo-filenames-list. By default the MuMaMo chunk family for .jsp files 
is "JSP nXhtml Family". You could change that to "JSP HTML Family".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about nxhtml-mode encoding problem
  2007-07-11 13:18           ` Lennart Borgman (gmail)
  2007-07-11 14:07             ` lu
@ 2007-07-12 13:56             ` lu
  2007-11-25 22:56               ` Lennart Borgman (gmail)
  1 sibling, 1 reply; 20+ messages in thread
From: lu @ 2007-07-12 13:56 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: help-gnu-emacs

Hi Lennart,
I do as you replied to me,it works well.
Thank you very much.
(setq mumamo-filenames-list (quote ((".php$" "nXhtml Family") (".lzx$" 
"OpenLaszlo Family") (".jsp$" "JSP HTML Family"))))
(mumamo-global-mode t)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about nxhtml-mode encoding problem
  2007-07-12 13:56             ` lu
@ 2007-11-25 22:56               ` Lennart Borgman (gmail)
  2007-11-26  4:53                 ` Ke Lu
  0 siblings, 1 reply; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-25 22:56 UTC (permalink / raw)
  To: lu@luxdo.jp; +Cc: help-gnu-emacs

Hi,

There is a new beta version of nXhtml available. If you are interested I 
welcome feedback!

   http://ourcomments.org/Emacs/nXhtml/doc/nxhtml-changes.html
   http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/


lu@luxdo.jp wrote:
> Hi Lennart,
> I do as you replied to me,it works well.
> Thank you very much.
> (setq mumamo-filenames-list (quote ((".php$" "nXhtml Family") (".lzx$" 
> "OpenLaszlo Family") (".jsp$" "JSP HTML Family"))))
> (mumamo-global-mode t)
> 
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about nxhtml-mode encoding problem
  2007-11-25 22:56               ` Lennart Borgman (gmail)
@ 2007-11-26  4:53                 ` Ke Lu
  2007-11-26  8:03                   ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 20+ messages in thread
From: Ke Lu @ 2007-11-26  4:53 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: help-gnu-emacs

Thank you very much.
I will try it.
I use jdee, jsp and viper, the things become difficut.
Does it been tested while using viper?
It seems it is not stabe enough, But I don't know in
which case.
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> Hi,
>
> There is a new beta version of nXhtml available. If you are interested I welcome
> feedback!
>
>   http://ourcomments.org/Emacs/nXhtml/doc/nxhtml-changes.html
>   http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/
>
>
> lu@luxdo.jp wrote:
>> Hi Lennart,
>> I do as you replied to me,it works well.
>> Thank you very much.
>> (setq mumamo-filenames-list (quote ((".php$" "nXhtml Family") (".lzx$"
>> "OpenLaszlo Family") (".jsp$" "JSP HTML Family"))))
>> (mumamo-global-mode t)
>>
>>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: about nxhtml-mode encoding problem
  2007-11-26  4:53                 ` Ke Lu
@ 2007-11-26  8:03                   ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-26  8:03 UTC (permalink / raw)
  To: Ke Lu; +Cc: help-gnu-emacs

It is no problem with Viper since I use Viper myself all the time. 
However jdee is another thing, I have not tested that, but would be glad 
for feedback.


Ke Lu wrote:
> Thank you very much.
> I will try it.
> I use jdee, jsp and viper, the things become difficut.
> Does it been tested while using viper?
> It seems it is not stabe enough, But I don't know in
> which case.
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> 
>> Hi,
>>
>> There is a new beta version of nXhtml available. If you are interested I welcome
>> feedback!
>>
>>   http://ourcomments.org/Emacs/nXhtml/doc/nxhtml-changes.html
>>   http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/
>>
>>
>> lu@luxdo.jp wrote:
>>> Hi Lennart,
>>> I do as you replied to me,it works well.
>>> Thank you very much.
>>> (setq mumamo-filenames-list (quote ((".php$" "nXhtml Family") (".lzx$"
>>> "OpenLaszlo Family") (".jsp$" "JSP HTML Family"))))
>>> (mumamo-global-mode t)
>>>
>>>
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-11-26  8:03 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-09 14:44 about xhtml-mode encoding problem lu
2007-07-09 15:31 ` Peter Dyballa
2007-07-09 16:07   ` lu
2007-07-09 17:08     ` Lennart Borgman (gmail)
2007-07-09 18:00     ` Peter Dyballa
2007-07-09 23:26       ` lu
2007-07-09 23:37       ` about nxhtml-mode " lu
2007-07-11 12:47         ` lu
2007-07-11 13:18           ` Lennart Borgman (gmail)
2007-07-11 14:07             ` lu
2007-07-12 13:56             ` lu
2007-11-25 22:56               ` Lennart Borgman (gmail)
2007-11-26  4:53                 ` Ke Lu
2007-11-26  8:03                   ` Lennart Borgman (gmail)
2007-07-09 16:12   ` about xhtml-mode " 呂 克
2007-07-09 17:59     ` Lennart Borgman (gmail)
2007-07-11 14:02       ` lu
2007-07-11 14:41         ` Lennart Borgman (gmail)
     [not found]   ` <mailman.3225.1183997250.32220.help-gnu-emacs@gnu.org>
2007-07-09 16:41     ` B. T. Raven
2007-07-09 23:29       ` lu

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 read-only IMAP folder(s) and NNTP newsgroup(s).