forked from science-ation/science-ation
COnversion script to convert all emails to UTF8, but still display properly on the site by back-encoding them to ISO-8859-1 (until such a time that we can switch the entire system to UTF8)
This commit is contained in:
parent
75e721bb81
commit
fde1debf6d
@ -244,6 +244,9 @@ case 'dialog_edit':
|
|||||||
</tr>
|
</tr>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
|
else if($key) {
|
||||||
|
echo "<input type=\"hidden\" name=\"key\" value=\"$key\" />\n";
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
@ -725,12 +728,12 @@ case "email_get_list":
|
|||||||
echo "</select>";
|
echo "</select>";
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
echo "<tr><td><b>Date:</b></td><td>".date("r")."</td></tr>";
|
echo "<tr><td><b>Date:</b></td><td>".date("r")."</td></tr>";
|
||||||
echo "<tr><td><b>Subject:</b></td><td>".htmlspecialchars($r->subject)."</td></tr>";
|
echo "<tr><td><b>Subject:</b></td><td>".htmlspecialchars(iconv("utf-8","ISO-8859-1",$r->subject))."</td></tr>";
|
||||||
if($r->bodyhtml) {
|
if($r->bodyhtml) {
|
||||||
$body=$r->bodyhtml;
|
$body=iconv("utf-8","ISO-8859-1",$r->bodyhtml);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$body=nl2br(htmlspecialchars($r->body));
|
$body=nl2br(htmlspecialchars(iconv("utf-8","ISO-8859-1",$r->body)));
|
||||||
|
|
||||||
echo "<tr><td colspan=2>".$body."</td></tr>";
|
echo "<tr><td colspan=2>".$body."</td></tr>";
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
154
|
155
|
||||||
|
14
db/db.update.155.php
Normal file
14
db/db.update.155.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?
|
||||||
|
|
||||||
|
function db_update_154_post() {
|
||||||
|
$q=mysql_query("SELECT * FROM emails");
|
||||||
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
mysql_query("UPDATE emails SET
|
||||||
|
body='".mysql_real_escape_string(iconv("ISO-8859-1","UTF-8",$r->body))."' ,
|
||||||
|
bodyhtml='".mysql_real_escape_string(iconv("ISO-8859-1","UTF-8",$r->bodyhtml))."' ,
|
||||||
|
subject='".mysql_real_escape_string(iconv("ISO-8859-1","UTF-8",$r->subject))."'
|
||||||
|
WHERE id='$r->id'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
7
db/db.update.155.sql
Normal file
7
db/db.update.155.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
ALTER TABLE `emails` CHANGE `body` `body` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||||
|
ALTER TABLE `emails` CHANGE `bodyhtml` `bodyhtml` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||||
|
ALTER TABLE `emails` CHANGE `subject` `subject` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||||
|
ALTER TABLE `emailqueue` CHANGE `body` `body` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||||
|
ALTER TABLE `emailqueue` CHANGE `bodyhtml` `bodyhtml` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||||
|
ALTER TABLE `emailqueue` CHANGE `subject` `subject` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||||
|
ALTER TABLE `emailqueue_recipients` CHANGE `replacements` `replacements` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
Loading…
x
Reference in New Issue
Block a user