331 /* 332 * Solaris uses HKSCS2001 333 */ 334 *std_encoding = "Big5-HKSCS-2001"; 335 } 336 #endif 337 #ifdef MACOSX 338 /* 339 * For the case on MacOS X where encoding is set to US-ASCII, but we 340 * don't have any encoding hints from LANG/LC_ALL/LC_CTYPE, use UTF-8 341 * instead. 342 * 343 * The contents of ASCII files will still be read and displayed 344 * correctly, but so will files containing UTF-8 characters beyond the 345 * standard ASCII range. 346 * 347 * Specifically, this allows apps launched by double-clicking a .jar 348 * file to correctly read UTF-8 files using the default encoding (see 349 * 8011194). 350 */ 351 if (strcmp(p,"US-ASCII") == 0 && getenv("LANG") == NULL && 352 getenv("LC_ALL") == NULL && getenv("LC_CTYPE") == NULL) { 353 *std_encoding = "UTF-8"; 354 } 355 #endif 356 } 357 358 free(temp); 359 free(encoding_variant); 360 361 return 1; 362 } 363 364 /* This function gets called very early, before VM_CALLS are setup. 365 * Do not use any of the VM_CALLS entries!!! 366 */ 367 java_props_t * 368 GetJavaProperties(JNIEnv *env) 369 { 370 static java_props_t sprops; 371 char *v; /* tmp var */ 372 | 331 /* 332 * Solaris uses HKSCS2001 333 */ 334 *std_encoding = "Big5-HKSCS-2001"; 335 } 336 #endif 337 #ifdef MACOSX 338 /* 339 * For the case on MacOS X where encoding is set to US-ASCII, but we 340 * don't have any encoding hints from LANG/LC_ALL/LC_CTYPE, use UTF-8 341 * instead. 342 * 343 * The contents of ASCII files will still be read and displayed 344 * correctly, but so will files containing UTF-8 characters beyond the 345 * standard ASCII range. 346 * 347 * Specifically, this allows apps launched by double-clicking a .jar 348 * file to correctly read UTF-8 files using the default encoding (see 349 * 8011194). 350 */ 351 const char* env_lang = getenv("LANG"); 352 const char* env_lc_all = getenv("LC_ALL"); 353 const char* env_lc_ctype = getenv("LC_CTYPE"); 354 355 if (strcmp(p,"US-ASCII") == 0 && 356 (env_lang == NULL || strlen(env_lang) == 0) && 357 (env_lc_all == NULL || strlen(env_lc_all) == 0) && 358 (env_lc_ctype == NULL || strlen(env_lc_ctype) == 0)) { 359 *std_encoding = "UTF-8"; 360 } 361 #endif 362 } 363 364 free(temp); 365 free(encoding_variant); 366 367 return 1; 368 } 369 370 /* This function gets called very early, before VM_CALLS are setup. 371 * Do not use any of the VM_CALLS entries!!! 372 */ 373 java_props_t * 374 GetJavaProperties(JNIEnv *env) 375 { 376 static java_props_t sprops; 377 char *v; /* tmp var */ 378 |