Skip to content

Commit f7dbf75

Browse files
committed
handle non whitespace space characters such as 'NO-BREAK SPACE'
1 parent eb96c8f commit f7dbf75

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/main/java/mil/nga/sf/util/TextReader.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ public String readToken() throws IOException {
119119
} else {
120120
// Complete the token before this character and cache
121121
// the character
122-
if (!Character.isWhitespace(character)) {
122+
if (!isWhitespace(character)) {
123123
nextCharacterNum = characterNum;
124124
}
125125
break;
126126
}
127127

128-
} else if (!Character.isWhitespace(character)) {
128+
} else if (!isWhitespace(character)) {
129129

130130
// First non whitespace character in the token
131131
builder = new StringBuilder();
@@ -191,4 +191,15 @@ private static boolean isTokenCharacter(char c) {
191191
|| (c >= '0' && c <= '9') || c == '-' || c == '.' || c == '+';
192192
}
193193

194+
/**
195+
* Check if the character is whitespace or a space character
196+
*
197+
* @param c
198+
* character
199+
* @return true if whitespace
200+
*/
201+
private static boolean isWhitespace(char c) {
202+
return Character.isWhitespace(c) || Character.isSpaceChar(c);
203+
}
204+
194205
}

0 commit comments

Comments
 (0)