}
if ( $t != -1 ) {
- return utf8_encode(strftime($f , $t));
+ return strftime($f , $t);
} else {
require_once('Date.php');
$date = new Date($d);
- return utf8_encode($date->format($f));
+ return $date->format($f);
}
}
--- /dev/null
+#!/usr/bin/php5
+<?php
+
+require_once 'connect.db.inc.php';
+
+function is_utf8($s)
+{
+ return @iconv('utf-8', 'utf-8', $s) == $s;
+}
+
+$tables = array ('city', 'city_in_maps', 'maps', 'pays', 'region');
+XDB::execute("SET NAMES 'latin1'");
+foreach ($tables as $table) {
+ $res = XDB::query("SELECT * FROM geoloc_$table");
+ if (!$res) {
+ echo "$table\n";
+ continue;
+ }
+ $all = $res->fetchAllAssoc();
+ foreach ($all as &$array) {
+ $from = array();
+ $to = array();
+ foreach ($array as $key=>$value) {
+ $from[] = $key . '="' . mysql_real_escape_string($value) . '"';
+ $valued = utf8_decode($value);
+ if (is_utf8($value) && $valued != $value) {
+ $to[] = $key . '="' . mysql_real_escape_string($valued) .'"';
+ }
+ }
+ if (!empty($to)) {
+ $to = implode(', ', $to);
+ $from = implode(' AND ', $from);
+ $sql = "UPDATE geoloc_$table SET $to WHERE $from";
+ if (!XDB::execute($sql)) {
+ echo "Echec : $sql\n";
+ }
+ }
+ }
+}
+
+?>
--- /dev/null
+#!/bin/sh
+
+WIKISPOOLDIR='../../spool/wiki.d/'
+
+find $WIKISPOOLDIR -name 'cache_*' -or -name 'tmp_*' -exec rm {} ";"
+for i in `find $WIKISPOOLDIR -type f`; do
+ mv $i $i.latin1
+ iconv -t UTF-8 $i.latin1 > $i
+done
+
+echo "Les pages de wiki ont ete converites en UTF-8"
+echo "Verifie que tout c'est bien passe en presse ^D"
+cat
+
+find $WIKISPOOLDIR -name '*.latin1' -exec rm {} ";"