Skip to content

Commit

Permalink
Fix RT #117683 on JVM \c[LINE FEED] \c[CARRIAGE RETURN]
Browse files Browse the repository at this point in the history
Also fixes \c[NEXT LINE] as well.
  • Loading branch information
samcv committed Jan 11, 2017
1 parent e3cf5bc commit 0c249e7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -4215,14 +4215,19 @@ public static String replace(String str, long offset, long count, String repl) {
public static long codepointfromname(String name) {
HashMap<String, Character> names = cpNameMap;
if (names == null) {
names = new HashMap< >();
/* Initialize the size as Character.MAX_VALUE */
names = new HashMap< >(Character.MAX_VALUE);
for (char i = 0; i < Character.MAX_VALUE; i++)
if (Character.isValidCodePoint(i))
names.put(Character.getName(i), i);
names.put("LF", (char)10);
names.put("FF", (char)12);
names.put("CR", (char)13);
names.put("NEL", (char)133);
names.put("LF", (char)10);
names.put("LINE FEED", (char)10);
names.put("FF", (char)12);
names.put("FORM FEED", (char)12);
names.put("CR", (char)13);
names.put("CARRIAGE RETURN", (char)13);
names.put("NEL", (char)133);
names.put("NEXT LINE", (char)133);
cpNameMap = names;
}
Character found = names.get(name);
Expand Down

0 comments on commit 0c249e7

Please sign in to comment.