mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-24 02:56:17 +01:00
process BOM before checking for comments
This commit is contained in:
parent
538e364674
commit
b335b5bb43
@ -262,8 +262,6 @@ public class Locale {
|
|||||||
BufferedReader reader = new BufferedReader(new InputStreamReader((InputStream) stream, charset));) {
|
BufferedReader reader = new BufferedReader(new InputStreamReader((InputStream) stream, charset));) {
|
||||||
String line;
|
String line;
|
||||||
for (int lineNumber = 0; (line = reader.readLine()) != null; lineNumber++) {
|
for (int lineNumber = 0; (line = reader.readLine()) != null; lineNumber++) {
|
||||||
if ((line = line.trim()).isEmpty() || line.startsWith("#") /* Comment */) continue;
|
|
||||||
|
|
||||||
if (lineNumber == 0){
|
if (lineNumber == 0){
|
||||||
// remove BOM markers, if any
|
// remove BOM markers, if any
|
||||||
line = line.replaceAll("[\uFEFF\uFFFE\u200B]", "");
|
line = line.replaceAll("[\uFEFF\uFFFE\u200B]", "");
|
||||||
@ -274,6 +272,8 @@ public class Locale {
|
|||||||
line = new String(encoded, 0, encoded.length, StandardCharsets.UTF_8);
|
line = new String(encoded, 0, encoded.length, StandardCharsets.UTF_8);
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
if ((line = line.trim()).isEmpty() || line.startsWith("#") /* Comment */) continue;
|
||||||
|
|
||||||
Matcher matcher = NODE_PATTERN.matcher(line);
|
Matcher matcher = NODE_PATTERN.matcher(line);
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
System.err.println("Invalid locale syntax at (line=" + lineNumber + "): " + line);
|
System.err.println("Invalid locale syntax at (line=" + lineNumber + "): " + line);
|
||||||
|
Loading…
Reference in New Issue
Block a user