My name is Dan and i have seen problems with UTF encoding earlier, read posts related to this kind of issues here on stackoverflow, tried the solutions that you guys have posted but i have to say i am stuck.
Ok, what i am making is a set of dropdowns that get populated via AJAX (jQuery) and PHP when tha values are changed.
- ALL files are saved as UTF-8
- The index.php file where all gets displayed have meta tag charset=utf-8
The PHP scripts reads directories and outputs list options based on folder names:
$fylke = $_GET['fylke'];
foreach (new DirectoryIterator('../pdfs/'.$fylke) as $fileInfo) {
if($fileInfo->isDot()) continue;
$kommune = $fileInfo->getFilename();
echo "<option name='kommune' value='".$kommune."'>".$kommune."</option>";
}
The Javascript runs functions based on listbox changes:
function getKommune() {
$.get("get.php",
{
fylke: $("#fylke").val()
},
function(data){
$('#kommune').html(data);
$('#kommune').attr('disabled', false);
$('#kommune').prepend('<option selected="selected" value="---">---</option>');
});
}
All folders and filenames with no special characters lists just fine. When it comes to a special character (æøå) the listbox do not update with folders or files.
I must say i am a beginner at coding, help is much appreciated. Here is a link to the non working project: http://www.tbds.no/pdfdl/
Thanks for the great help.
I want to share the script with you if you want it, but implement security! : www.dan-levi.no/playground/pdfdown/files.zip