PHP and UTF-8

Recently I have asked for help regarding an automated PHP gallery. The script is now finished, but i face one more problem.

Here is the script:


<?php
$directory = "path/of/directory";

foreach (glob($directory . "*.jpg") as $pathinfo) {
		
               echo '<a href="' . $pathinfo . '">
			         <img src="' . $pathinfo . '" width="500" height="333" title="' . basename($pathinfo, ".jpg") . '"/>
					 </a>';
}
?>

Since I’m in Croatia, I use special characters ( e.g. č, ć, š, đ, ž ). Html can read the characters fine, but PHP obviously has a problem with that. I’ve tried decoding and encoding, declaring the UTF-8 in the head of PHP, but nothing works. The problem is that it can’t read the directory path if there are special characters, but instead of echo-ing them correctly, i get “?”
Does anyone know how to enable special characters?

Anyone?

I’ve never had to deal with this issue. However, a little research seems to indicate that PHP is not capable of handling certain UTF-8 characters in file names or paths.

Possible work around:

http://stackoverflow.com/questions/1525830/how-do-i-use-filesystem-functions-in-php-using-utf-8-strings

Also see:

http://stackoverflow.com/questions/708017/can-a-php-file-name-or-a-dir-in-its-full-path-have-utf-8-characters