--- fpicker/source/unx/kde/kdefilepicker.cxx	2007-07-03 17:16:36.000000000 +0200
+++ fpicker/source/unx/kde/kdefilepicker.cxx	2007-07-03 19:32:57.000000000 +0200
@@ -260,38 +260,14 @@ void FileDialog::customEvent( QCustomEve
                     {
                         KURL::List qList( selectedURLs() );
                         for ( KURL::List::const_iterator it = qList.begin(); it != qList.end(); ++it )
-                        {
-                            qString.append( " " );
-                            QString qUrlStr = addExtension( (*it).url() );
-
-                            if ( !isExecuting() && !isSupportedProtocol( KURL( qUrlStr ).protocol() ) )
-                                qUrlStr = localCopy( qUrlStr );
-
-                            if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" )
-                                qUrlStr.replace( "file:/", "file:///" );
-
-                            if ( !qUrlStr.isEmpty() )
-                                appendEscaped( qString, qUrlStr );
-                        }
+                            appendURL( qString, (*it) );
                     }
                     else
                     {
                         // we have to return the selected files anyway
                         const KFileItemList *pItems = ops->selectedItems();
                         for ( KFileItemListIterator it( *pItems ); it.current(); ++it )
-                        {
-                            qString.append( " " );
-                            QString qUrlStr = addExtension( (*it)->url().url() );
-
-                            if ( !isExecuting() && !isSupportedProtocol( KURL( qUrlStr ).protocol() ) )
-                                qUrlStr = localCopy( qUrlStr );
-
-                            if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" )
-                                qUrlStr.replace( "file:/", "file:///" );
-
-                            if ( !qUrlStr.isEmpty() )
-                                appendEscaped( qString, qUrlStr );
-                        }
+                            appendURL( qString, (*it)->url() );
                     }
 
                     sendCommand( qString );
@@ -662,7 +639,8 @@ KURL FileDialog::mostLocalURL( const KUR
 
 QString FileDialog::localCopy( const QString &rFileName ) const
 {
-    KURL qLocalURL = mostLocalURL( KURL( rFileName ) );
+    // 106 == MIB enum for UTF-8
+    KURL qLocalURL = mostLocalURL( KURL( rFileName, 106 ) );
     if ( qLocalURL.isLocalFile() )
         return qLocalURL.url();
 
@@ -713,6 +691,28 @@ void FileDialog::sendCommand( const QStr
     ::std::cout << rCommand.utf8() << ::std::endl;
 }
 
+void FileDialog::appendURL( QString &rBuffer, const KURL &rURL )
+{
+    // From Martin Kretzschmar:
+    // file:///path/to/test%E0.odt is not a valid URL from OOo's point of
+    // view. (?Most modern parts of?) OOo assume(s) that the URL contains only
+    // ASCII characters (which test%E0.odt does) and is UTF-8 after unescaping
+    // (which file:///path/test%E0.odt is not).
+    // Cf. the comment in sal/inc/osl/file.h.
+    // 106 == MIB enum for UTF-8
+    QString qUrlStr = addExtension( rURL.url( 0, 106 ) );
+
+    if ( !isExecuting() && !isSupportedProtocol( rURL.protocol() ) )
+        qUrlStr = localCopy( qUrlStr );
+
+    if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" )
+        qUrlStr.replace( "file:/", "file:///" );
+
+    rBuffer.append( " " );
+    if ( !qUrlStr.isEmpty() )
+        appendEscaped( rBuffer, qUrlStr );
+}
+
 void FileDialog::appendEscaped( QString &rBuffer, const QString &rString )
 {
     const QChar *pUnicode = rString.unicode();
--- fpicker/source/unx/kde/kdefilepicker.hxx	2007-07-03 11:35:37.000000000 +0200
+++ fpicker/source/unx/kde/kdefilepicker.hxx	2007-07-03 19:10:58.000000000 +0200
@@ -142,6 +142,7 @@ protected slots:
 
 protected:
     void                        sendCommand( const QString &rCommand );
+    void                        appendURL( QString &rBuffer, const KURL &rURL );
     void                        appendEscaped( QString &rBuffer, const QString &rString );
     QString                     escapeString( const QString &rString );
 };
