< prev index next >

src/java.base/unix/native/libjava/java_props_md.c

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 296          */
 297         if (strcmp(p, "EUC-JP") == 0) {
 298             *std_encoding = "EUC-JP-LINUX";
 299         }
 300 #endif
 301 
 302 #ifdef _AIX
 303         if (strcmp(p, "big5") == 0) {
 304             /* On AIX Traditional Chinese Big5 codeset is mapped to IBM-950 */
 305             *std_encoding = "IBM-950";
 306         } else if (strcmp(p, "IBM-943") == 0) {
 307             /*
 308              * On AIX, IBM-943 is mapped to IBM-943C in which symbol 'yen' and
 309              * 'overline' are replaced with 'backslash' and 'tilde' from ASCII
 310              * making first 96 code points same as ASCII.
 311              */
 312             *std_encoding = "IBM-943C";
 313         }
 314 #endif
 315 
 316 #ifdef __solaris__
 317         if (strcmp(p,"eucJP") == 0) {
 318             /* For Solaris use customized vendor defined character
 319              * customized EUC-JP converter
 320              */
 321             *std_encoding = "eucJP-open";
 322         } else if (strcmp(p, "Big5") == 0 || strcmp(p, "BIG5") == 0) {
 323             /*
 324              * Remap the encoding string to Big5_Solaris which augments
 325              * the default converter for Solaris Big5 locales to include
 326              * seven additional ideographic characters beyond those included
 327              * in the Java "Big5" converter.
 328              */
 329             *std_encoding = "Big5_Solaris";
 330         } else if (strcmp(p, "Big5-HKSCS") == 0) {
 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) &&


   1 /*
   2  * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 296          */
 297         if (strcmp(p, "EUC-JP") == 0) {
 298             *std_encoding = "EUC-JP-LINUX";
 299         }
 300 #endif
 301 
 302 #ifdef _AIX
 303         if (strcmp(p, "big5") == 0) {
 304             /* On AIX Traditional Chinese Big5 codeset is mapped to IBM-950 */
 305             *std_encoding = "IBM-950";
 306         } else if (strcmp(p, "IBM-943") == 0) {
 307             /*
 308              * On AIX, IBM-943 is mapped to IBM-943C in which symbol 'yen' and
 309              * 'overline' are replaced with 'backslash' and 'tilde' from ASCII
 310              * making first 96 code points same as ASCII.
 311              */
 312             *std_encoding = "IBM-943C";
 313         }
 314 #endif
 315 





















 316 #ifdef MACOSX
 317         /*
 318          * For the case on MacOS X where encoding is set to US-ASCII, but we
 319          * don't have any encoding hints from LANG/LC_ALL/LC_CTYPE, use UTF-8
 320          * instead.
 321          *
 322          * The contents of ASCII files will still be read and displayed
 323          * correctly, but so will files containing UTF-8 characters beyond the
 324          * standard ASCII range.
 325          *
 326          * Specifically, this allows apps launched by double-clicking a .jar
 327          * file to correctly read UTF-8 files using the default encoding (see
 328          * 8011194).
 329          */
 330         const char* env_lang = getenv("LANG");
 331         const char* env_lc_all = getenv("LC_ALL");
 332         const char* env_lc_ctype = getenv("LC_CTYPE");
 333 
 334         if (strcmp(p,"US-ASCII") == 0 &&
 335             (env_lang == NULL || strlen(env_lang) == 0) &&


< prev index next >