Conversion de fichiers en UTF-8
Moodle1.6
Certains fichiers, notamment ceux des paquetages de langue personnalisés ou les fichiers de langue de modules de tierces parties doivent être convertis en UTF-8 avant de pouvoir être utilisés dans Moodle 1.6.
Cet article vous indique comment effectuer cette conversion.
Ordinateurs basés sur Unix (Mac OS X, Linux, etc.)
La conversion s'effectue au moyen de la commande iconv :
iconv -f encodage_original -t utf-8 fichier_original > nouveau_fichier
Ordinateurs sous Windows
Sous Windows, aucun outil gratuit n'existe pour faire la conversion. Toutefois, on peut l'effectuer avec [Cygwin], un environnement Linux fonctionnant dans Windows, et en lançant la commande iconv dans cet environnement.
Example of a working sollution on Windows with [Cygwin]:
- Create a text file, named ToUtf8.txt
- Fill it with the following code
#!/bin/bash FROM=iso-8859-1 TO=UTF-8 ICONV="iconv -f $FROM -t $TO" # Convert find ToUTF/ -type f -name "*" | while read fn; do cp ${fn} ${fn}.bak $ICONV < ${fn}.bak > ${fn} rm ${fn}.bak done
Two things should be changed for your local situation:
- FROM is the originating encoding (the one your original files are in)
- ToUTF is the foldername where the files that need to be converted are in. This folder may contain subfolders. Make sure you have a backup!
- Start Cygwin.
- With the cd foldername, cd.., ls commands, go to the folder on your windows machine where the ToUtf8.txt-script and the ToUTF8 folder are in.
- Execute the script by typing sh ToUtf8.txt and your files will be converted.