[Top][All Lists]

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

convert whole website from iso-8859-2/1 to utf-8

From: Miroslav Rovis
Subject: convert whole website from iso-8859-2/1 to utf-8
Date: Wed, 07 Jul 2004 04:18:35 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040406

The files all have either:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
if in Croatian and
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
if in English or Italian, just as they're supposed to.

The iso-8859-2 files gave much resistance and broke a few nerves here at my desktop and around...
Until that is, I found:
> prefer-coding-system utf-8
> C-x C-f filename
After these two lines, what does Emacs print if you say
  M-: buffer-file-coding-system RET
Mine said iso-latin-1-dos instead of iso-latin-2-dos (pages made long ago, in the days mule wasn't yet an option for simple Emacs users... and Linux was truly hard to understand as well; now I do use it much better...)
So, as per:
I set:
(add-hook 'find-file-hooks
          '(lambda ()
             (if (equal buffer-file-coding-system 'iso-latin-2)
                 (set-language-environment "Latin-2"))))
in my .emacs file
But I am not certain that worked for me though...

Therefore I also made sure I learned to just
M-x set-buffer-file-coding-system RET

in case it read -1(DOS)--
instead of -2(DOS)-- in the modeline (at the very left)

Surely now:
(Perhaps it is easiest to tell Emacs to save as UTF-8, by doing C-x
RET f utf-8 RET.)
the advice above worked fine.

(There was just no way to get it right when the buffer-file-coding-system variable was set to latin-1, the "meta ... charset=iso-8859-2" in the head of the html file made no difference.)

But, going manually is not an option, since I have a couple of hundreds pages, and then, I would like to be able to do it on other similar occasions.

Is there a lisp program for such conversion that could be run in batch mode?
If I engage I would certainly employ at least a week to learn such lisping if I would be able to make it at all.
Does anyone have any suggestion?
At least which functions to begin considering for this task?

I did find e.g.:
#!/use/bin/emacs --script
;; And after that you can use regular elisp code:
(princ "Hello world!")
;; end.
and I already experimented in the line on:
emacs -batch file -f function -l lisp-code-from-file
but I remained disoriented as to how these kind of things need are really done. But if someone supplied a few hints I'll delve with some more hope into all those volumes of Emacs lore...

So thank you, knowledgeable and kind reader if you care to help!
Miroslav Rovis

reply via email to

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