How can the issue of question marks being generated in CSV data records be resolved in PHP?

Issue: Question marks can be generated in CSV data records when special characters are not properly encoded. To resolve this issue, we can use the `utf8_encode()` function in PHP to encode the data before writing it to the CSV file.

// Sample CSV data with special characters
$data = "Special character: é";

// Encode the data using utf8_encode()
$encoded_data = utf8_encode($data);

// Write the encoded data to the CSV file
$file = fopen('data.csv', 'w');
fputcsv($file, array($encoded_data));
fclose($file);