Hi Nick

Another issue is that at the moment TYP compiler does not support codepage 65001.

OK thanks, please try the attached patch.

Steve
Index: src/uk/me/parabola/mkgmap/main/TypCompiler.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/main/TypCompiler.java	(revision 4251)
+++ src/uk/me/parabola/mkgmap/main/TypCompiler.java	(date 1542135591000)
@@ -26,6 +26,7 @@
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.StandardOpenOption;
 
 import uk.me.parabola.imgfmt.ExitException;
@@ -211,8 +212,13 @@
 		}
 
 		private void setCodePage(String codePage) {
-			this.codePage = codePage;
-			this.encoder = Charset.forName(codePage).newEncoder();
+			if ("cp65001".equalsIgnoreCase(codePage)) {
+				this.codePage = "utf-8";
+				this.encoder = StandardCharsets.UTF_8.newEncoder();
+			} else {
+				this.codePage = codePage;
+				this.encoder = Charset.forName(codePage).newEncoder();
+			}
 		}
 
 		private String probeCharset(String file) {
Index: src/uk/me/parabola/mkgmap/typ/LineSection.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/typ/LineSection.java	(revision 4251)
+++ src/uk/me/parabola/mkgmap/typ/LineSection.java	(date 1542116445000)
@@ -12,6 +12,7 @@
  */
 package uk.me.parabola.mkgmap.typ;
 
+import uk.me.parabola.imgfmt.app.typ.ColourInfo;
 import uk.me.parabola.imgfmt.app.typ.TypData;
 import uk.me.parabola.imgfmt.app.typ.TypLine;
 import uk.me.parabola.mkgmap.scan.SyntaxException;
@@ -62,4 +63,14 @@
 		current.finish();
 		data.addLine(current);
 	}
+
+	protected void xpmCheck(TokenScanner scanner, ColourInfo colourInfo) {
+		int width = colourInfo.getWidth();
+
+		if (width == 0)
+			return;
+
+		if (width != 32)
+			throw new SyntaxException(scanner, "Line bitmaps must be 32 bits wide");
+	}
 }
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to