[TYPO3-dev] TYPO3 & MSSQL & utf-8/ucs-2

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Wed May 21 18:54:59 CEST 2008


Georg Ringer schrieb:
> Hi,
> 
> I need to set up a website with MSSQL and I need a different character 
> set than iso latin-1 because I got russian and some other east european 
> languages.
> 
> Problems seems that MSSQL can't handle utf-8 but just ucs-2. I can set 
> the forceCharset in the install-tool but this still won't help because 
> the DB is kind of iso (we don't really know).

I have no idea how you can set the encoding of the MS SQL server to 
UCS-2, but I suggest you consult the documentation ;-)

> So my questions are:
> - Anyone ever did what I need to do (saving utf8/ucs2 into MSSQL with 
> TYPO3)?

I never tried to but I fear that using UCS-2 with PHP/TYPO3 may lead to 
troubles. UCS-2 strings may contain NULL bytes, so you have to make sure 
every functions is binary safe. Furthermore I guess it break in many 
places as TYPO3 expects each encoding to be 7-bit ASCII compatible *

So you can either create an SQL proxy that recodes all data sent from or 
to the DB or make that happen in an XCLASS of t3lib_db. But beware, you 
must not change any real binary data. This means you have to check the 
data type of the columns like ADOdb/DBAL does before you apply any 
conversion.

Masi

* This means any single byte below 0x80 is in all character encodings 
the same. This is true for UTF-8, but not for UCS-2 which uses a word (2 
bytes) to store those characters.




More information about the TYPO3-dev mailing list