jdk/src/solaris/native/java/lang/java_props_md.c
changeset 19197 f557ac307d1b
parent 16041 b9d38accf302
child 19857 d3a868255edb
equal deleted inserted replaced
19196:5368bd038f19 19197:f557ac307d1b
   359              * Solaris uses HKSCS2001
   359              * Solaris uses HKSCS2001
   360              */
   360              */
   361             *std_encoding = "Big5-HKSCS-2001";
   361             *std_encoding = "Big5-HKSCS-2001";
   362         }
   362         }
   363 #endif
   363 #endif
       
   364 #ifdef MACOSX
       
   365         /*
       
   366          * For the case on MacOS X where encoding is set to US-ASCII, but we
       
   367          * don't have any encoding hints from LANG/LC_ALL/LC_CTYPE, use UTF-8
       
   368          * instead.
       
   369          *
       
   370          * The contents of ASCII files will still be read and displayed
       
   371          * correctly, but so will files containing UTF-8 characters beyond the
       
   372          * standard ASCII range.
       
   373          *
       
   374          * Specifically, this allows apps launched by double-clicking a .jar
       
   375          * file to correctly read UTF-8 files using the default encoding (see
       
   376          * 8011194).
       
   377          */
       
   378         if (strcmp(p,"US-ASCII") == 0 && getenv("LANG") == NULL &&
       
   379             getenv("LC_ALL") == NULL && getenv("LC_CTYPE") == NULL) {
       
   380             *std_encoding = "UTF-8";
       
   381         }
       
   382 #endif
   364     }
   383     }
   365 
   384 
   366     free(temp);
   385     free(temp);
   367     free(encoding_variant);
   386     free(encoding_variant);
   368 
   387