+ GCPRO1 (filename);
+ encoded_filename = ENCODE_UTF_8 (filename);
+ UNGCPRO;
+
+ fstr = [NSString stringWithUTF8String: SDATA (encoded_filename)];
+ if (fstr == nil) fstr = @"";
+#ifdef NS_IMPL_COCOA
+ /* work around a bug observed on 10.3 and later where
+ setTitleWithRepresentedFilename does not clear out previous state
+ if given filename does not exist */
+ if (! [[NSFileManager defaultManager] fileExistsAtPath: fstr])
+ [[view window] setRepresentedFilename: @""];
+#endif