--- gftp-2.9.1b/lib/ftp-dir-listing.c.old	2024-07-01 21:03:44.877313412 -0400
+++ gftp-2.9.1b/lib/ftp-dir-listing.c	2024-07-01 21:07:51.201734399 -0400
@@ -140,7 +140,7 @@
 {
   struct tm curtime, *loctime;
   time_t t, ret;
-  char *tmppos;
+  char *tmppos, *format;
   size_t slen;
   int i, num;
 
@@ -170,7 +170,18 @@
       /* Jul 06 12:57 or Jul  6  1999 */
       if (strchr (str, ':') != NULL)
         {
-          tmppos = strptime (str, "%h %d %H:%M", &curtime);
+#ifndef __sun
+           tmppos = strptime (str, "%h %d %H:%M", &curtime);
+#else
+#  if ENABLE_NLS
+          format = dcgettext ("SUNW_OST_OSCMD", " %b %e %H:%M", LC_TIME);
+          if (format && *format == ' ')
+            format++;
+          tmppos = strptime (str, format, &curtime);
+#  else
+          tmppos = strptime (str, "%b %e %H:%M", &curtime);
+#  endif
+#endif
           t = time (NULL);
           loctime = localtime (&t);
 
@@ -417,6 +428,7 @@
 {
   //DEBUG_TRACE("LSUNIX: %s\n", str);
   char *endpos, *startpos, *pos, *attribs;
+  char *backup_lc_time, *remote_lc_time;
   int cols;
   ftp_protocol_data * ftpdat = request->protocol_data;
 
@@ -525,7 +537,17 @@
   while (*startpos == ' ')
     startpos++;
 
-  fle->datetime = parse_time (startpos, &startpos);
+#if ENABLE_NLS
+  backup_lc_time = setlocale (LC_TIME, NULL);
+  gftp_lookup_request_option (request, "remote_lc_time", &remote_lc_time);
+  if (backup_lc_time && remote_lc_time != NULL && *remote_lc_time != '\0')
+    setlocale (LC_TIME, remote_lc_time);
+#endif
+   fle->datetime = parse_time (startpos, &startpos);
+#if ENABLE_NLS
+  if (backup_lc_time && remote_lc_time != NULL && *remote_lc_time != '\0')
+    setlocale (LC_TIME, backup_lc_time);
+#endif
 
   /* Skip the blanks till we get to the next entry */
   startpos = goto_next_token (startpos);
--- gftp-2.9.1b/lib/protocols.c.old	2024-07-01 21:08:53.175365431 -0400
+++ gftp-2.9.1b/lib/protocols.c	2024-07-01 21:12:17.445866678 -0400
@@ -352,12 +352,13 @@
 gftp_list_files (gftp_request * request)
 {
   DEBUG_PRINT_FUNC
-  char *remote_lc_time, *locret;
-  int fd;
+  char *backup_lc_time, *remote_lc_time, *locret;
+  int fd, ret;
 
   g_return_val_if_fail (request != NULL, GFTP_EFATAL);
 
 #if ENABLE_NLS
+  backup_lc_time = setlocale (LC_TIME, NULL);
   gftp_lookup_request_option (request, "remote_lc_time", &remote_lc_time);
   if (remote_lc_time != NULL && *remote_lc_time != '\0')
     locret = setlocale (LC_TIME, remote_lc_time);
@@ -384,6 +385,9 @@
 
       request->cachefd = fd;
       request->cached = 1;
+#if ENABLE_NLS
+      setlocale (LC_TIME, backup_lc_time);
+#endif
       return (0);
     }
   else if (request->use_cache)
@@ -397,9 +401,18 @@
     }
 
   if (request->list_files == NULL)
-    return (GFTP_EFATAL);
+    {
+#if ENABLE_NLS
+      setlocale (LC_TIME, backup_lc_time);
+#endif
+      return (GFTP_EFATAL);
+    }
 
-  return (request->list_files (request));
+  ret = request->list_files (request);
+#if ENABLE_NLS
+  setlocale (LC_TIME, backup_lc_time);
+#endif
+  return (ret);
 }
 
 
@@ -809,6 +822,12 @@
 gftp_set_directory (gftp_request * request, const char *directory)
 {
   DEBUG_PRINT_FUNC
+  mode_t st_mode;
+  off_t linksize;
+  char *locale_directory = NULL;
+  int fd;
+  size_t dest_len;
+
   g_return_val_if_fail (request != NULL, GFTP_EFATAL);
   g_return_val_if_fail (directory != NULL, GFTP_EFATAL);
 
@@ -822,6 +841,29 @@
         }
       return (0);
     }
+  else if (request->url_prefix && !strcmp (request->url_prefix, "file"))
+    {
+      st_mode = 0;
+      linksize = 0;
+      gftp_stat_filename (request, directory, &st_mode, &linksize);
+      if (!S_ISDIR (st_mode))
+        {
+          locale_directory = gftp_filename_from_utf8 (request, directory, &dest_len);
+          if (locale_directory != NULL &&
+              (fd = gftp_fd_open (request, locale_directory, O_RDONLY, 0)) != -1)
+            {
+              close (fd);
+              request->directory = g_strdup (directory);
+            }
+          else if ((fd = gftp_fd_open (request, directory, O_RDONLY, 0)) != -1)
+            {
+              close (fd);
+              request->directory = g_strdup (directory);
+            }
+          g_free (locale_directory);
+          return (0);
+        }
+    }
   else if (request->chdir == NULL)
     return (GFTP_EFATAL);
   return (request->chdir (request, directory));