简体   繁体   中英

TYPO3: indexed_search and encoding

I have a TYPO3 v. 4.3.2 and Indexed Search Engine 2.12.0. If I make a search I see a

Ö instead of Ö
ü instead of ü

So it seems that utf8 characters are represented as ISO-8859-1. If I look into the source code I see

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

In the TS setup there is also a

page.config.metaCharset = utf-8
page.config.additionalHeaders = Content-Type:text/html;charset=utf-8

So it is a settings from the indexed search extension?

You need to set the database and Typo3 to uft-8. In Typo3 it is with the option forceCharset=utf-8 and setDBinit = set names utf-8 and set character set utf-8 in the installtool. To convert a mysql database to utf-8 at the command line type:

Dumped the original db with the following command:

mysqldump -u root -p --opt --default-character-set=latin1 --skip-set-charset  DBNAME > DBNAME

Then using sed I changed all occurrences of the word latin1 to utf8:

sed -e 's/latin1/utf8/g' -i ./DBNAME.sql

From here I then created the new database and then imported the dumpfile.

mysql -p -e "create database DBNAME"
mysql -p --default-character-set=utf8  DBNAME < DBNAME.sql

Here is what the mysql manual wrote about alter table tbl_name CONVERT TO...

http://dev.mysql.com/doc/refman/5.0/en/alter-table.html

" If you want to change the table default character set and all character columns (CHAR, VARCHAR, TEXT) to a new character set, use a statement like this:

ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;

Warning

The preceding operation converts column values between the character sets. This is not what you want if you have a column in one character set (like latin1) but the stored values actually use some other, incompatible character set (like utf8). In this case, you have to do the following for each such column:

 ALTER TABLE t1 CHANGE c1 c1 BLOB;
 ALTER TABLE t1 CHANGE c1 c1 TEXT CHARACTER SET utf8;

The reason this works is that there is no conversion when you convert to or from BLOB columns. "

If you need to convert the content you need to either dump it and use my method or use ALTER TABLE tbl_name CHANGE ... for each column.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM