Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/lang/System/NonAnsiFileEncodingTest.java
41149 views
1
/*
2
* Copyright (c) 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.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 4459099
27
* @key i18n
28
* @summary Tests non ANSI code page locales set default file encoding
29
* to "utf-8". This test must be run on Windows 2K/XP in one of Armenian,
30
* Georgian, Hindi, Punjabi, Gujarati, Tamil, Telugu, Kannada, Marathi,
31
* or Sanskrit languages.
32
*/
33
34
public class NonAnsiFileEncodingTest {
35
public static void main(String[] s) {
36
String OS = System.getProperty("os.name");
37
String lang = System.getProperty("user.language");
38
String fileenc = System.getProperty("file.encoding");
39
40
if (!(OS.equals("Windows 2000") || OS.equals("Windows XP"))) {
41
System.out.println("This test is not meaningful on the platform \"" + OS + "\".");
42
return;
43
}
44
45
if (!(lang.equals("hy") || // Armenian
46
lang.equals("ka") || // Georgian
47
lang.equals("hi") || // Hindi
48
lang.equals("pa") || // Punjabi
49
lang.equals("gu") || // Gujarati
50
lang.equals("ta") || // Tamil
51
lang.equals("te") || // Telugu
52
lang.equals("kn") || // Kannada
53
lang.equals("mr") || // Marathi
54
lang.equals("sa"))) { // Sanskrit
55
System.out.println("Windows' locale settings for this test is incorrect. Select one of \"Armenian\", \"Georgian\", \"Hindi\", \"Punjabi\", \"Gujarati\", \"Tamil\", \"Telugu\", \"Kannada\", \"Marathi\", or \"Sanskrit\" for the user locale, and \"English(United States)\" for the system default locale using the Control Panel.");
56
return;
57
}
58
59
if (!fileenc.equals("utf-8")) {
60
throw new RuntimeException("file.encoding is incorrectly set to \"" + fileenc + "\". Should be \"utf-8\".");
61
}
62
}
63
}
64
65