[TYPO3-dev] typo3 5.0

R. van Twisk typo3 at rvt.dds.nl
Mon Oct 30 19:10:25 CET 2006


Martin Kutschker wrote:
> Dmitry Dulepov schrieb:
>   
>> Hi!
>>
>> Martin Kutschker wrote:
>>
>>     
>>> R. van Twisk schrieb:
>>>
>>>       
>>>> be careful with serialized arrays in a database.
>>>> If your data is in latin1, and at some point you want to upgrade
>>>> to utf-8 (database) then your serialized arrays might break.
>>>> when you let iconv  or mysql do the conversion.
>>>>         
>>> How come? Why did iconv break your array?
>>>       
>> Some characters may translate into two byte utf-8 characters but PHP's 
>> array length will not change in the serialized form. This way, for 
>> example, you may loose all your templavoila mapping if you have 
>> non-english charaters in them...
>>     
>
> I see. But only a minor problem if the updating scripts knows that it deals 
> with serialied arrays: simply unserialize, convert and serialize again.
>
> Note that any updating script also have to know about XML because if the 
> charset declaration.
>
> Masi
> _______________________________________________
>   
Hi masi, you made a very good point there,
the XML is indeed stored with a encoding type. I would
almost we shouldn't do it, and the encoding type of the XML
as always the encoding of the DB's encoding type.

However the update scripts are a lot easer doing this in the
XML then with serialized arrays...

Otherwise it needs a connection to two databases and the update
extension needs import from one DB (latin1) and send to
a other DB which would be in utf8 (or other encoding).

You can't do it in the same DB since the serialized array would
be corrupt like a chicken and a egg problem.

A other possible solution would be this with a script:

1) Dump all tables to separate files in teh encoding the DB was in.
2) Delete all fields in the DB
3) Let the script handle the connection setting changes aswell as
 setting the DB tables and fields to the new encoding
4)  import the stored tables again...


This sounds like a fairly dangerous operation on large databases,
timeouts... what if something goes wrong, rollback etc...

Ries
 








-- 
Ries van Twisk
Freelance Typo3 Developer
=== Private:
email: ries at vantwisk.nl
web:   http://www.rvantwisk.nl/freelance-typo3.html
skype: callto://r.vantwisk
=== Work:
email: ries at livetravelguides.com
web:   http://www.livetravelguides.com





More information about the TYPO3-dev mailing list