 |
 |
 |
 |
Registered: 06/07/07
Posts: 4
|
|
|
 |
 |
 |
 |
|
 |
 |
 |
 |
|
Express Hosting
"We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#247238 - 12/13/11 01:22 PM
Re: Changing the character encoding of all posts in database
[Re: Conrad]
|

|
Registered: 12/20/03
Posts: 4424
Loc: Lutz,FL
|
|
That is what the issue was! Finally jogged my memory. Currently there is not a built in script to convert the tables. As long as you start with a net new install it is okay. From the old version 8 change log that became vaporware. By Rick: The other big step is the conversion of the table types to a character set of utf8. All of the data within the various tables will be converted to utf8, and all timestamps will be converted to GMT.
Yes, version 8 is going to be a very large update. All of the tables will be changing, lowercasing, utf8, splitting up the posts table, etc. All of the scripts will be changing, the templates, skins, etc. It's probably more major than the version 7 upgrade was wink
It's probably going to be easiest if you're already running version 7.5.x when version 8 comes out so it can upgrade directly, oth
_________________________
Blue Man Group
|
|
Top
|
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#247473 - 12/27/11 12:45 PM
Re: Changing the character encoding of all posts in database
[Re: Ruben]
|
addict
|
Registered: 08/04/04
Posts: 425
|
|
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
set_time_limit(360000);
ini_set("memory_limit","9000M");
header ('Content-type: text/html; charset=ISO-8859-2');
$db = new PDO('mysql:host=localhost;port=3306; dbname=mecz_ubb;', 'root', 'mecz');
// ubbt_ADDRESS_BOOK ubbt_ADMIN_LOG ubbt_ADMIN_SEARCHES ubbt_ANNOUNCEMENTS ubbt_BANNED_EMAILS ubbt_BANNED_HOSTS ubbt_BANNED_USERS ubbt_BBCODE ubbt_CACHE ubbt_CACHED_PERMISSIONS ubbt_CALENDAR_EVENTS ubbt_CAPTCHA ubbt_CATEGORIES ubbt_CENSOR_LIST ubbt_CHECK_DATA ubbt_CP_PERMISSIONS ubbt_DISPLAY_NAMES ubbt_FILES ubbt_FORUMS ubbt_FORUM_LAST_VISIT ubbt_FORUM_PERMISSIONS ubbt_GRAEMLINS ubbt_GROUPS ubbt_LANGUAGES ubbt_MAILER ubbt_MEMBER_SEARCHES ubbt_MODERATORS ubbt_MODERATOR_NOTIFICATIONS ubbt_ONLINE ubbt_PAYPAL_DATA ubbt_PERMISSION_LIST ubbt_POINTER_DELETE ubbt_POLL_DATA ubbt_POLL_OPTIONS ubbt_POLL_VOTES ubbt_PORTAL_BOXES ubbt_POSTS
$table = "ubbt_POSTS";
$q = $db->query("DESCRIBE $table ");
$fields = $q->fetchAll(PDO::FETCH_OBJ);
$fieldsArr = array();
foreach($fields as $row){
$fieldsArr[] = $row->Field;
}
$db->query("TRUNCATE utf_{$table}");
$q = $db->query("SELECT * FROM $table");
$data = $q->fetchAll(PDO::FETCH_OBJ);
$db->query("SET NAMES UTF8");
foreach($data as $row){
$values = array();
foreach($fields as $field){
$fname = $field->Field;
$val = $row->$fname;
$val = iconv('ISO-8859-2','UTF-8', $val);
$values[] = "'{$val}'";
}
$sql = "INSERT INTO utf_{$table} (".implode(',', $fieldsArr).") VALUES (".implode(',', $values).")";
$st = $db->query($sql);
}
Does this script seem right for changing the encoding of data within the database to UTF-8?
|
|
Top
|
|
|
|
|
 |
 |
 |
 |
|
|