File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -927,8 +927,25 @@ void setup_Rmainloop(void)
927927 putenv (Rarch );
928928 }
929929#else /* not Win32 */
930+
931+ { /* Avoid annoying warnings if LANG and LC_ALL are unset or empty.
932+ This happens e.g. on Mac when primary language clash with region,
933+ like English in Denmark or Germany. Use LANG, not LC_ALL in case
934+ some of the other LC_* variables are set - Apple Terminal can e.g.
935+ set LC_CTYPE=UTF-8.
936+
937+ If LANG or LC_ALL has been set to a non-existing locale, we assume
938+ that the user wants to ne informed. */
939+
940+ char * s ;
941+
942+ if (!(s = getenv ("LANG" ) && * s ) && !(s = getenv ("LC_ALL" ) && * s ))
943+ setenv ("LANG" , "C" , 1 );
944+ }
945+
930946 if (!setlocale (LC_CTYPE , "" ))
931947 snprintf (deferred_warnings [ndeferred_warnings ++ ], 250 ,
948+
932949 "Setting LC_CTYPE failed, using \"C\"\n" );
933950 if (!setlocale (LC_COLLATE , "" ))
934951 snprintf (deferred_warnings [ndeferred_warnings ++ ], 250 ,
You can’t perform that action at this time.
0 commit comments