Hi guys, good morning.
I've just get this script for converting mysql tables from wordpress, and I want to use it in my server, but no with wordpress, with oscommerce, a friend of mine told me a few things I should do for make it working, but less than a rookie in PHP, began studying it now ¬¬", and sure I dont know how to use command line yet, she told me something about using command line along with FTP ascii table, I'm lost, couldn't do that, how do I install it? How do I configurate it?
Ps: the script is for converting ascii characters for utf-8 or latin1. If u have anything else that can help me instead of using it, please let me know, here u see how's oscommerce http://www.mghospedagem.com/catalog/
u can see on the left that there are strange characters (oscommerce chars configuration is correct, the trouble's with the server, I contacted em but they didn't nothing, that's why I'm trying to install this script)
Here goes the script "convert_to_utf 8_sql_generator _extended.txt" - <?php
-
/*
-
Template Name: Convert Database to UTF8
-
-
Copyright 2007 Anders Stalheim Oefsdahl (email : anders@apt.no)
-
Detail at http://www.mydigitallife.info/2007/07/22/how-to-convert-character-set-and-collation-of-wordpress-database/
-
-
Bug fix by My Digital Life on 22 June 2007.
-
-
This program is free software; you can redistribute it and/or modify
-
it under the terms of the GNU General Public License as published by
-
the Free Software Foundation; either version 2 of the License, or
-
(at your option) any later version.
-
-
This program is distributed in the hope that it will be useful,
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
GNU General Public License for more details.
-
-
You should have received a copy of the GNU General Public License
-
along with this program; if not, write to the Free Software
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
*/
-
-
echo '<h1>Convert Database to UTF8</h1>';
-
-
echo '<p>This script generates SQL to convert existing tables to utf8, following the guide at <a href="http://codex.wordpress.org/Converting_Database_Character_Sets">http://codex.wordpress.org/Converting_Database_Character_Sets</a>, temporarily setting various fields to BLOB before setting them back to their respective types.</p>';
-
echo '<p>This is an extended script for databases which are already utf8 but the strings are in latin1. It converts existing tables and colums to latin1 before the BLOB conversion</p>';
-
echo '<p>Please note that you probably will get some errors running the scripts, regarding key length on some tables. These errors can be ignored (at least I did :).</p>';
-
-
require_once("wp-config.php");
-
global $wpdb;
-
-
/**
-
* Fetch all tables
-
*/
-
$tables = array();
-
$sql_tables = "SHOW TABLES";
-
$res_tables = $wpdb->get_results( $sql_tables );
-
if( is_array( $res_tables ) ){
-
foreach( $res_tables as $res_table ){
-
if(strpos($res_table->Tables_in_DATABASENAME, $table_prefix) === 0)
-
$tables[$res_table->Tables_in_DATABASENAME] = array();
-
}
-
}
-
/**
-
* Loop all tables fetching each table's fields and filter out fields of type CHAR, VARCHAR, TEXT, ENUM, and SET (and related variations)
-
*/
-
if( count( $tables )>0 ){
-
foreach( $tables as $table=>$fields ){
-
// if (strpos($table_prefix, $table) == 0)
-
// {
-
$sql_fields = "EXPLAIN ".$table;
-
$res_fields = $wpdb->get_results( $sql_fields );
-
if( is_array( $res_fields ) ){
-
foreach( $res_fields as $field ){
-
switch( TRUE ){
-
case strpos( strtolower( $field->Type ), 'char' )===0:
-
case strpos( strtolower( $field->Type ), 'varchar' )===0:
-
case strpos( strtolower( $field->Type ), 'text' )===0:
-
case strpos( strtolower( $field->Type ), 'enum' )===0:
-
case strpos( strtolower( $field->Type ), 'set' )===0:
-
case strpos( strtolower( $field->Type ), 'tinytext' )===0:
-
case strpos( strtolower( $field->Type ), 'mediumtext' )===0:
-
case strpos( strtolower( $field->Type ), 'longtext' )===0:
-
$tables[$table][$field->Field] = $field->Type;
-
break;
-
-
default:
-
break;
-
}
-
}
-
// }
-
}
-
}
-
}
-
-
$tables_to_latin1 = '';
-
$tables_to_utf8 = '';
-
$columns_to_latin1 = '';
-
$columns_to_blob = '';
-
$columns_to_utf8 = '';
-
-
foreach( $tables as $table=>$fields ){
-
$tables_to_latin1 .= "\nALTER TABLE ".$table." DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
-
$tables_to_utf8 .= "\nALTER TABLE ".$table." DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;";
-
if( count( $fields )>0 ){
-
foreach( $fields as $name=>$type ){
-
$columns_to_latin1 .= "\nALTER TABLE ".$table." MODIFY ".$name." CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
-
$columns_to_blob .= "\nALTER TABLE ".$table." MODIFY ".$name." BLOB;";
-
$columns_to_utf8 .= "\nALTER TABLE ".$table." MODIFY ".$name." ".$type.";";
-
}
-
}
-
}
-
-
//$complete_sql = $sql_to_blob."\nALTER DATABASE ".DB_NAME." charset=utf8;".$sql_to_utf8.$sql_to_original;
-
$complete_sql = $tables_to_latin1."\n".$columns_to_latin1."\n".$columns_to_blob."\n".$tables_to_utf8."\n".$columns_to_utf8;
-
-
echo nl2br( $complete_sql );
-
-
?>
5 2430 Markus 6,050
Recognized Expert Expert
This seems like overkill. You might just change the content-type header of the page to something like: ISO-8859-1. -
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-
</head>
-
<body>
-
...
-
Sorry, but...
I already did it =/
Markus 6,050
Recognized Expert Expert
It doesn't works, I tried both. That friend of mine told me that the trouble is with the server, that I should install a script that correct that. She did it in her server, made a script and it worked,
I asked if she could handle me the script but she sad she spent hours making it, now I found that one on the internet, shown her and she said that it will work if I install it corretly, she tryied to teach me how to install and configurate but dindt has too much time, she has been pretty busy.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: LMachado1 |
last post by:
I just started with php and I'm trying to make a simple interface as
follows:
- user is asked to input an integers, for example: how many students do
you want to enter?
- user is then shown a page with number of text boxes = number he gave
at the previous page
- user fills out the test boxes with names of students and clicks
submit
- the user is sent to another page where the above names are output to
|
by: Jakle |
last post by:
I'm trying to write a program (with my very limited knowledge of python)
that will convert text I type into those letters drawn with ascii symbols. I
did 2 letters then went to test it. Here's the code I have so far:
*******************************************
def S():
print " ________ "
print " /--------\ "
print "// \\"
print "|| ^^"
|
by: Haines Brown |
last post by:
I understand that <br /> is marginal in CSS, and so am looking for a
substitute for the EOL character. I've failed in both approaches and
seek advice.
The first thing I tried was to use the unicode EOL characer, which is
000A. I figured with was 10 in decimal notation, and so tried:
line 1
line 2
No go. What was wrong with my thinking here?
|
by: stevelooking41 |
last post by:
Can someone explain why I don't seem unable to use document.write to
produce a valid UTF-8 none breaking space sequence (Hex: C2A0) ?
I've tried everyway I've been able to find to tell the browser I'm
trying to print UTF-8 and still no luck. I'd like the first 2 tries to
match the second two tries as far as output.
<HTML>
<meta http-equiv="Content-Type" content="application/x-script;
charset=UTF-8">
|
by: Daniel Walzenbach |
last post by:
Hi,
I have a web application which sometimes throws an “out of memoryâ€
exception. To get an idea what happens I traced some values using performance
monitor and got the following values (for one day):
\\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During
Execution: 7
\\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
| |
by: Michael |
last post by:
Hi all,
I'm having trouble PInvoking a TCHAR within a struct.
I'll paste the specific struct's API definition below.
I've tried so many numerous variations.
The main Win32 error I get is 0x3f0 / 515L which amounts to ERROR_NO_TOKEN.
Every single instance of this in the past was due to mistakes I made while
within PInvoked structs.
Is anybody able to point me to documentation or just tell me outright how to
|
by: Marc Scheuner |
last post by:
Folks,
we're trying to stream back a result set from a SQL query into Excel
from our ASP.NET application.
Basically, we're doing this here:
Response.ContentType = "text/csv";
Response.Charset = "utf-8";
|
by: Torsten Bronger |
last post by:
Hallöchen!
I thought that with the following code snippet, I could generate a
MIME email stub:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from email.MIMEText import MIMEText
from email.Generator import Generator
import sys
|
by: cutlass |
last post by:
Need you assistance to anyone who is willing to offer. I have been working on this script and can't get it to work.
The issue I'm having is the statement:
function validateSender($Address) {
if (strpos($Address, '@') !== FALSE && strpos($Address, '.') !== FALSE) {
return true;
}
else if (validateSender($_GET) == false) {
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |