Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 1735)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 1736)
@@ -103,4 +103,6 @@
 			the issue where the maximize editor button does not vertically expand the editing
 			area in Firefox.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1842">#1842</a>] PHP integration: 
+			fixed filename encoding problems in file browser.</li>
 	</ul>
 	<h3>
Index: /FCKeditor/trunk/editor/filemanager/browser/default/browser.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/browser.html	(revision 1735)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/browser.html	(revision 1736)
@@ -25,4 +25,5 @@
 	<head>
 		<title>FCKeditor - Resources Browser</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 		<link href="browser.css" type="text/css" rel="stylesheet">
 		<script type="text/javascript" src="js/fckxml.js"></script>
Index: /FCKeditor/trunk/editor/filemanager/browser/default/frmactualfolder.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/frmactualfolder.html	(revision 1735)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/frmactualfolder.html	(revision 1736)
@@ -24,4 +24,5 @@
 <html>
 	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 		<link href="browser.css" type="text/css" rel="stylesheet">
 		<script type="text/javascript">
Index: /FCKeditor/trunk/editor/filemanager/browser/default/frmfolders.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/frmfolders.html	(revision 1735)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/frmfolders.html	(revision 1736)
@@ -26,4 +26,5 @@
 	<head>
 		<link href="browser.css" type="text/css" rel="stylesheet">
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 		<script type="text/javascript" src="js/common.js"></script>
 		<script language="javascript">
Index: /FCKeditor/trunk/editor/filemanager/browser/default/frmresourceslist.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/frmresourceslist.html	(revision 1735)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/frmresourceslist.html	(revision 1736)
@@ -25,4 +25,5 @@
 <head>
 	<link href="browser.css" type="text/css" rel="stylesheet" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 	<script type="text/javascript" src="js/common.js"></script>
 	<script type="text/javascript">
Index: /FCKeditor/trunk/editor/filemanager/browser/default/frmupload.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/frmupload.html	(revision 1735)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/frmupload.html	(revision 1736)
@@ -25,4 +25,5 @@
 	<head>
 		<title>File Upload</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 		<link href="browser.css" type="text/css" rel="stylesheet" />
 		<script type="text/javascript" src="js/common.js"></script>
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/util.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/util.php	(revision 1735)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/util.php	(revision 1736)
@@ -35,4 +35,27 @@
 }
 
+function FindBadUtf8( $string )
+{
+	$regex =
+	'([\x00-\x7F]'.
+	'|[\xC2-\xDF][\x80-\xBF]'.
+	'|\xE0[\xA0-\xBF][\x80-\xBF]'.
+	'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
+	'|\xED[\x80-\x9F][\x80-\xBF]'.
+	'|\xF0[\x90-\xBF][\x80-\xBF]{2}'.
+	'|[\xF1-\xF3][\x80-\xBF]{3}'.
+	'|\xF4[\x80-\x8F][\x80-\xBF]{2}'.
+	'|(.{1}))';
+
+	while (preg_match('/'.$regex.'/S', $string, $matches)) {
+		if ( isset($matches[2])) {
+			return true;
+		}
+		$string = substr($string, strlen($matches[0]));
+	}
+
+	return false;
+}
+
 function ConvertToXmlAttribute( $value )
 {
@@ -46,5 +69,5 @@
 	}
 
-	if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' )
+	if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' || FindBadUtf8( $value ) )
 	{
 		return ( utf8_encode( htmlspecialchars( $value ) ) ) ;
Index: /FCKeditor/trunk/editor/filemanager/connectors/test.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/test.html	(revision 1735)
+++ /FCKeditor/trunk/editor/filemanager/connectors/test.html	(revision 1736)
@@ -25,4 +25,5 @@
 <head>
 	<title>FCKeditor - Connectors Tests</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 	<script type="text/javascript">
 
Index: /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html	(revision 1735)
+++ /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html	(revision 1736)
@@ -24,4 +24,5 @@
 	<head>
 		<title>FCKeditor - Uploaders Tests</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 		<script type="text/javascript">
 
