importPackage(java.io);
importPackage(java.lang);
// \x9 throws an error when using JavaScript (SMonkey 24.2.0).
print("\\x only works with two hex digits: TAB\x9TAB\x090TAB");
print("\\x is ISO-8859-1: 0x80 = \x80, 0x81 = \x81, 0x90 = \x90, 0x9A = \x9A, 0x9F = \x9F");
print("\\x is _not_ creating UTF-8: \xE0\xBC\x82"); // UTF-8 bytes for U+0F02
print("");
print("BMP Code Point / UTF-16 via \\u: \u0F02");
print("UTF-16 Surrogate Pair via \\u: \uD83D\uDC7E"); // U+1F47E
print("");
// \u{} throws an error when using JavaScript (SMonkey 24.2.0).
print("\\u{} is noted as being \"experimental, should not be used in production code\":");
print("Code Point / UTF-32 via \\u{}: \u{0F02}"); // NO EFFECT (YET!!!)
print("Code Point / UTF-32 via \\u{}: \u{1F47E}"); // NO EFFECT (YET!!!)
print("-------------------------------");
print("UTF-16 via String.fromCharCode(decimal): " + String.fromCharCode(3842));
print("UTF-16 via String.fromCharCode(hex): " + String.fromCharCode(0x0F02));
print("");
print("UTF-16 Surrogate Pair via String.fromCharCode(decimal): " + String.fromCharCode(55357, 56446));
print("UTF-16 Surrogate Pair via String.fromCharCode(hex): " + String.fromCharCode(0xD83D, 0xDC7E));
print("");
print("Multiple UTF-16 via String.fromCharCode(decimal): " + String.fromCharCode(3842, 32, 55357, 56446));
print("Multiple UTF-16 via String.fromCharCode(hex): " + String.fromCharCode(0x0F02, 0x20, 0xD83D, 0xDC7E));
print("-------------------------------");
// Like \x, the octal escape sequence uses the ISO-8859-1 character set
print("Octal notation is \\888 where '888' = 1 - 3 octal digits (values 0 - 7; range 0 - 377):");
print("\\11 and \\011: tab\11tabby\011tab");
print("\\7, \\07, and \\007: bell\7bell\07bell\007bell");
print("\\176 = \176 ; \\177 = \177 ; \\200 = \200 ; \\237 = \237");
print("\\242 = \242 ; \\377 = \377 ; \\504 = \504");
print("-------------------------------");
// String.fromCodePoint() raises an error in both (rhino 1.7.7) and (SMonkey 24.2.0).
//print("Code Point / UTF-32 via String.fromCodePoint(decimal): " + String.fromCodePoint(3842));
//print("Code Point / UTF-32 via String.fromCodePoint(hex): " + String.fromCodePoint(0x0F02));