Jump to:

22972 Posts in 11596 Topics by 2824 members

General Questions

SilverStripe Forums » General Questions » Â Â Â Â Â Â Â <-- these characters keep appearing!

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 3136 Views
  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Â Â Â Â Â Â Â <-- these characters keep appearing! Link to this post

    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!

  • moloko_man
    Avatar
    Community Member
    72 Posts

    Re: Â Â Â Â Â Â Â <-- these characters keep appearing! Link to this post

    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.

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Â Â Â Â Â Â Â <-- these characters keep appearing! Link to this post

    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

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Â Â Â Â Â Â Â <-- these characters keep appearing! Link to this post

    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...

  • jocuri
    Avatar
    Community Member
    3 Posts

    Re: Â Â Â Â Â Â Â <-- these characters keep appearing! Link to this post

    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..

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Â Â Â Â Â Â Â <-- these characters keep appearing! Link to this post

    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...

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Â Â Â Â Â Â Â <-- these characters keep appearing! Link to this post

    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>

    3136 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.