jeudi 16 novembre 2017

Issues with database entries with special characters

I've got a minor script that runs every now and then for my Shoutcast Radio. The code is as below, so we have a log of what has been played on air.

if($dnas_data['SONGTITLE'] != $song) {
    DB::table('radio_logs')->insert([
        'djid' => $djid,
        'dj' => $dnas_data['SERVERTITLE'],
        'song' => $dnas_data['SONGTITLE'],
        'listeners' => $dnas_data['REPORTEDLISTENERS'],
        'time' => $hour,
        'day' => $day,
        'dateline' => $time
    ]);
}

The issue comes that sometimes a song from artists like Beyoncè comes up on the radio as é due to the way Mac encodes the song title. Anyway, that's not the issue, the issue is that when this happens and é comes up instead of è it breaks my script as above.

What can I do to help fix this so it doesn't break the code when special characters like è are in the titles?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2yKRF9M
via IFTTT

Aucun commentaire:

Enregistrer un commentaire