Re: [SumsaultRT #212] iso-8859-1 vs. utf-8

Le jeudi, 25 sep 2003, à 12:29 America/Montreal, Richard Ishida a écrit 
:
> Yep.  I think I alluded to this further down in my message.   However,
> I'd like to encourage the mode of thought that it's a much better plan
> to try and find a utf-8 capable editor than to just fall back on the
> entities.

Another solution:

* iconv
iconv is a small unix program (works on Linux, BSD, Mac OS X)
http://www.gnu.org/software/libiconv/
http://www.gnu.org/software/libiconv/documentation/libiconv/iconv.1.html

For example to convert from iso-8859-1 to utf-8

karl% iconv -f ISO-8859-1 -t UTF-8 fileold.html > filenew.html

If you want to convert a lot of files, create a small scripts like that.

==================
#!/bin/sh
#
# Shell Script
# to convert a file from Latin 1 to utf-8

WEBDIR=`find  /home/mywebsites/files/ -name '*.html'`

echo "********** Converting File *******"
for i in $WEBDIR;
do
     iconv -f ISO-8859-1 -t UTF-8 $i > $i.new
     mv $i.new $i
done
==================

--
Karl Dubost - http://www.w3.org/People/karl/
W3C Conformance Manager
*** Be Strict To Be Cool ***

Received on Thursday, 25 September 2003 13:39:16 UTC