Mercurial > hg > openjdk > aarch64-port > nashorn
changeset 1408:24cb54d0bfa2
Merge
author | sundar |
---|---|
date | Tue, 02 Jun 2015 17:59:28 +0530 |
parents | d03088193a17 (current diff) e5b03cc6f269 (diff) |
children | 556876366259 |
files | |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk/nashorn/internal/runtime/Source.java Tue Jun 02 10:40:19 2015 +0200 +++ b/src/jdk/nashorn/internal/runtime/Source.java Tue Jun 02 17:59:28 2015 +0530 @@ -910,14 +910,16 @@ start = 2; cs = StandardCharsets.UTF_16BE; } else if (bytes.length > 1 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE) { - start = 2; - cs = StandardCharsets.UTF_16LE; + if (bytes.length > 3 && bytes[2] == 0 && bytes[3] == 0) { + start = 4; + cs = Charset.forName("UTF-32LE"); + } else { + start = 2; + cs = StandardCharsets.UTF_16LE; + } } else if (bytes.length > 2 && bytes[0] == (byte) 0xEF && bytes[1] == (byte) 0xBB && bytes[2] == (byte) 0xBF) { start = 3; cs = StandardCharsets.UTF_8; - } else if (bytes.length > 3 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE && bytes[2] == 0 && bytes[3] == 0) { - start = 4; - cs = Charset.forName("UTF-32LE"); } else if (bytes.length > 3 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == (byte) 0xFE && bytes[3] == (byte) 0xFF) { start = 4; cs = Charset.forName("UTF-32BE");