php - fgetcsv() notice: "escape must be a single character" with 'µ'

519

When I usefgetcsv() withescape =µ like this

$filename = 'test.csv';
$handle = fopen($filename, 'r');
$a = fgetcsv($handle, 0, ';', '"', 'µ');

php outputs a notice

Notice: fgetcsv() [function.fgetcsv]: escape must be a single character in myPhpFile.php on line 23

Why?

621

Answer

Solution:

µ isn't a standard Ascii character. Which means that PHP sees it as an UTF-8 encoded character which are 16 bits while Ascii is 8 bits. Hence the multiple characters. You should use something else.

People are also looking for solutions to the problem: php - CodeIgniter Search engine not working correct - Get ONLY published posts

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.