1

I got following result when i do dd($somevariable) in laravel

array:12 [
  0 => {#223
    +"jobinspt_post_questions_id": 117
    +"category": "Fascia & Gutter"
    +"question": "The F&G is complete"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  1 => {#224
    +"jobinspt_post_questions_id": 118
    +"category": "Fascia & Gutter"
    +"question": "Temporary props are in use"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  2 => {#225
    +"jobinspt_post_questions_id": 119
    +"category": "Fascia & Gutter"
    +"question": "The F&G is straight, level and undamaged"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  3 => {#226
    +"jobinspt_post_questions_id": 120
    +"category": "Fascia & Gutter"
    +"question": "F&G at correct height and distance from frame"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  4 => {#227
    +"jobinspt_post_questions_id": 121
    +"category": "Fascia & Gutter"
    +"question": "Dutch gables are cut neatly and level"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  5 => {#228
    +"jobinspt_post_questions_id": 122
    +"category": "Fascia & Gutter"
    +"question": "All rafter brackets are installed"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  6 => {#229
    +"jobinspt_post_questions_id": 123
    +"category": "Fascia & Gutter"
    +"question": "All barge gutters/ returns are installed"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  7 => {#230
    +"jobinspt_post_questions_id": 124
    +"category": "Fascia & Gutter"
    +"question": "Hips and jacks are propped"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  8 => {#231
    +"jobinspt_post_questions_id": 125
    +"category": "Fascia & Gutter"
    +"question": "Ext & Int corners are installed"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  9 => {#232
    +"jobinspt_post_questions_id": 126
    +"category": "Fascia & Gutter"
    +"question": "Rake downs/ laybacks/drag downs installed"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  10 => {#233
    +"jobinspt_post_questions_id": 127
    +"category": "Fascia & Gutter"
    +"question": b"Rivets – correct colour and number"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  11 => {#234
    +"jobinspt_post_questions_id": 128
    +"category": "Fascia & Gutter"
    +"question": "Downpipes pops or drops installed as per plan"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }

]

when i encode this array to json i got the following error

json_encode(): Invalid UTF-8 sequence in argument

I dont know where is that invalid utf8 sequence. Please help me to find out what is wrong with this array

2 Answers 2

1

Look at element 10 in the array dump:

+"question": b"Rivets – correct colour and number"

there is a 'b' character that needs to be removed.

Sign up to request clarification or add additional context in comments.

Comments

0

if you are using MYSQL then try this

$con = mysqli_connect('localhost', 'my_user', 'my_password', 'test');
mysqli_set_charset($con, 'utf8');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.