I can remove them with...
return utf8_decode ($content);
... but why do these things keep appearing on sites? how can I rid myself of them for ever?
please help! it is driving me CRAZY!
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
I can remove them with...
return utf8_decode ($content);
please help! it is driving me CRAZY!
I only see them crop up when I'm in Dev mode and I'm outputting stuff with Debug::show();
I would assume there is a character in one of the base classes that you'll have to find.
Now that I think about it, I've seen stuff like this crop up when my co-worker uses Dreamweaver to edit php files with the wysiwyg editor, you'll have to zap the gremlins.
Thanks, I did kinda throw it out there without much info... made me remember teh chinese outsurcers that left chinese comments in the code (amongst other things...)
It is coming from the database it gets into the content, page titles, etc.
I think it is after I run a mysqldump and then restore it (all via Lunix shell and without transferring the file out the box), but today just upgrading a site to 2.4.5 and running a db build did it this time...
any advice now I've been a bit more specific - any ideas? config settings? db settings?
all suggestions welcome :)
Thanks to FinBoWa on IRC...
using
SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';
to see that my db was...
collation_connection utf8_general_ci
collation_database latin1_swedish_ci
collation_server latin1_swedish_ci
Then after running the following SQL (from http://muzso.hu/2008/04/09/how-to-change-the-character-set-and-or-collation-in-a-mysql-database-for-all-tables-and-c)
SELECT CONCAT('ALTER TABLE `', t.`TABLE_SCHEMA`, '`.`', t.`TABLE_NAME`, '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;') as stmt
FROM `information_schema`.`TABLES` t
WHERE 1
AND t.`TABLE_SCHEMA` = 'sm_sandbox'
ORDER BY 1
the collation is this...
collation_connection utf8_general_ci
collation_database utf8_general_ci
collation_server latin1_swedish_ci
I am removing the characters for the last time (hopefully) as my db should now be setup correctly, if not I'll update this thread...
I think you could also try to filter the input, and everytime someone introduces this kind of letters you will replace them with what ever you want..
Hi jocuri,
Thank you for the reply - in my case everyone is adding characters like... ', £ or just a space (for all I can tell) and then after a dev build or a backup and restore the strange characters appear. I did strip these characters when displaying "Content" - but it affects every HTMLText and Text field (again for as far as I can tell) - How would I easily filter it from all of these do you think? Create a custom HTMLTextField and TextField class? I'd be concerned that that is the wrong way to go about it...
so this now seems to have settled down... the solution was to add the following vhost.conf in the conf folder of the vhost...
<Directory /var/www/vhosts/NAMEOFDOMAIN/httpdocs/>
AddDefulatCharset UTF-8
</Directory>