Forums / Install & configuration / Database charset conversion (downgrade sql to non utf-8)

Database charset conversion (downgrade sql to non utf-8)

Author Message

Nick Ursa

Moderated by: Nicolas Pastorino

Wednesday 24 January 2007 7:37:28 am

Hey ai could really use some help.

We need to switch hosts for our ezpublish sites but the new one has MYsql 4.0.23 while the old one had Mysql 4.1.x

We had originaly set up for unicode support so the database was set up using UTF-8 and our pages were output as UTF-8. The primary use was to be able to output trademark and copyright characters easily.

I need to transition to MYSQL 4.0.23 while preserving these characters. Copyright has an ISO-8859 equivalent while trademark does not. These fields are stored as text lines in the Class, not XHTML. However we cna substirtute them with HTML entitites if need be.

What I need to know is the following:

How to export a mysqldump from a UTF-8 database into latin-1..
What settings should I use in siteaccess.ini and i18.ini for in the following

site.ini:

[DatabaseSettings]
Charset=utf-8

i18n.ini:
[CharacterSettings]
Charset=utf-8

template.ini:
[CharsetSettings]
DefaultTemplateCharset=utf-8

Do i use "latin"1 or "iso-8859-1" ... the documentation is sparse on this.

Vicente Olivan

Wednesday 24 January 2007 9:57:31 am

Hi

I believe that is better crearte new database in mysql 4.0.x. with utf8 support

test this...

export old database:

mysqldump --opt database > backup.sql

create new database:

mysql -u root

CREATE DATABASE `database` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

quit

import old database:

mysql database < backup.sql

... you will not have to change all settings.

greetings

Kim Johansen

Thursday 25 January 2007 12:29:30 am

"DEFAULT CHARSET=" is not supported in mysql 4.0. You need to convert the database.

Dump the database and remember to use --skip-set-charset, or use the sed command after you have created the dump

mysqldump -u username -p --skip-set-charset database > dump.sql
sed -e 's/ DEFAULT CHARSET=UTF-8//' dump.sql > dump_fix.sql

Convert to ISO-8859-1

iconv --from-code=UTF-8 --to-code=ISO-8859-1 dump.sql > new_dump.sql

Dump database back to new server

mysql -u username -p database < new_dump.sql

This should be all.

Try out Free eZ Publish 4.0 Trial Hosting for 14 days:
http://webdealhosting.com/ez-publish-trial-hosting

High quality eZ Publish Hosting since 2001!

Kristof Coomans

Thursday 25 January 2007 12:53:08 am

Of course it depends on your needs, but I think that downgrading from utf8 to latin1 generally isn't a good idea. If it is possible then consider upgrading the mysql server.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Xavier Dutoit

Thursday 25 January 2007 5:38:35 am

Hi,

I have utf8 on mysql 4.0 servers. I know they are limitations/problems but it has been running smoothly on my sites so far.

Skip the iconv step and see how it works for you.

Another option (the one I used) was
1) create the tables (empty) on the 4.0 server
(kernel/sql/mysql/kernel_schema.sql )
2) dump only the datas from the 4.1 database

3) Import on the existing empty tables

Might make it easier...

Let us know.

X+

http://www.sydesy.com

zurgutt -

Wednesday 13 June 2007 1:11:00 am

Firstly: for the love of God (or whatever you love), keep everything everything in utf from the beginning. Saves so much headache.. i know..

For dump conversion see my solution on this thread: http://ez.no/community/forum/general/convert_from_iso_8859_1_encoding_to_utf_8/re_convert_from_iso_8859_1_encoding_to_utf_8__9

It has worked for me. But its crude, so heed the warnings. Might not work for you. But trying wont hurt.

Certified eZ developer looking for projects.
zurgutt at gg.ee

eZ debug

Timing: Jan 18 2025 03:03:45
Script start
Timing: Jan 18 2025 03:03:45
Module start 'content'
Timing: Jan 18 2025 03:03:46
Module end 'content'
Timing: Jan 18 2025 03:03:46
Script end

Main resources:

Total runtime0.8000 sec
Peak memory usage4,096.0000 KB
Database Queries213

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 589.0938180.8047
Module start 'content' 0.00610.6474 769.8984750.2500
Module end 'content' 0.65350.1464 1,520.1484340.4219
Script end 0.7999  1,860.5703 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.5089210.0002
Check MTime0.00150.1837210.0001
Mysql Total
Database connection0.00060.080810.0006
Mysqli_queries0.698287.26742130.0033
Looping result0.00230.29312110.0000
Template Total0.763895.520.3819
Template load0.00210.266520.0011
Template processing0.761695.199520.3808
Template load and register function0.00040.044010.0004
states
state_id_array0.00190.240210.0019
state_identifier_array0.00270.338620.0014
Override
Cache load0.00190.2410640.0000
Sytem overhead
Fetch class attribute can translate value0.00260.322170.0004
Fetch class attribute name0.00170.2171100.0002
XML
Image XML parsing0.00430.532970.0006
class_abstraction
Instantiating content class attribute0.00000.0027100.0000
General
dbfile0.00841.0486460.0002
String conversion0.00000.001030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
17content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 40
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs