Editor 1.7.3 : error message if json_encode fails

Editor 1.7.3 : error message if json_encode fails

madmikemadmike Posts: 30Questions: 4Answers: 0

HI, using Editor 1.7.3, I'm receive an error message :
{"error":"JSON encoding error: Malformed UTF-8 characters, possibly incorrectly encoded"}.

  1. How I can have mode information to debug. ?
  2. Is it possible to add something to force utf encoding if not ?

Thanks for help.
Mike

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @madmike ,

    Has the database been set to support UTF-8?

    Cheers,

    Colin

  • madmikemadmike Posts: 30Questions: 4Answers: 0

    Yes it is.

    I temporary solve using a query in the database : https://stackoverflow.com/questions/1476356/detecting-utf8-broken-characters-in-mysql

    But there is a way to avoid that in Editor, or add a treatment in the PHP json answer ? And where do that ?

    Thanks

  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin
    Answer ✓

    Try calling:

    $db->sql( 'set names utf8' );
    

    Just before you create the Editor PHP instance.

    Allan

  • madmikemadmike Posts: 30Questions: 4Answers: 0

    @allan thanks a lot

  • AtongraaffAtongraaff Posts: 1Questions: 0Answers: 0

    HI , you write to set $db->sql( 'set names utf8' ); but I have no idea in what file I have to write this. my main file is ritbeheer that calls ritten.php just like in the trial package is called staff.php.
    my structure is ;

    I have been searching for days now but have no clue.

  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin

    Put it just before your Editor:inst( $db .... ) call.

    Allan

This discussion has been closed.