From 4deaabdce4f18c27a76d7c62c562ccf4537e113a Mon Sep 17 00:00:00 2001 From: strump Date: Tue, 11 Apr 2017 18:44:03 +0300 Subject: [PATCH] Added default encoding for Java source code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows 10 x64 Russian with Java 8.0.1210.13 compiler uses cyrillic encoding "cp1251" by default. That's why gradle fails with error ``` Validating translations Incremental java compilation is an incubating feature. :OsmAnd-java:compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.7 E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\data\MapObject.java:26: error: unmappable character for encoding Cp1251 * Looks like: {ru=Москва, dz=à½?ོསི་ཀོ...} and does not contain values of OSM tags "name" and "name:en", ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:98: error: unmappable character for encoding Cp1251 String s = "Ú¯Ú† Ù¾Ú? نمکی باللغة العربي"; ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:101: error: unmappable character for encoding Cp1251 if (!reshape.equals("ﻲﺑﺮﻌﻟﺍ ﺔﻐﻠﻟﺎﺑ ﯽﮑﻤﻧ ﮋï­? ﭻﮔ")) { ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:89: error: unclosed character literal char[] c = new char[] {'א', 'ד','ם'} ; ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:89: error: ';' expected char[] c = new char[] {'א', 'ד','ם'} ; ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:89: error: unclosed character literal char[] c = new char[] {'א', 'ד','ם'} ; ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:89: error: unclosed character literal char[] c = new char[] {'א', 'ד','ם'} ; ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:89: error: illegal character: '\u201c' char[] c = new char[] {'א', 'ד','ם'} ; ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:89: error: ';' expected char[] c = new char[] {'א', 'ד','ם'} ; ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:89: error: unclosed character literal char[] c = new char[] {'א', 'ד','ם'} ; ^ E:\projects\Android\osmand_project\osmandapp\android\OsmAnd-java\src\net\osmand\Reshaper.java:89: error: not a statement char[] c = new char[] {'א', 'ד','ם'} ; ^ 8 errors 1 warning FAILED FAILURE: Build failed with an exception. ``` I've added expllicit encoding setting for Java compiler. --- OsmAnd-java/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-java/build.gradle b/OsmAnd-java/build.gradle index d2c6cb958e..eb7b6077bf 100644 --- a/OsmAnd-java/build.gradle +++ b/OsmAnd-java/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'java' apply plugin: 'application' mainClassName = "net.osmand.util.GeoPointParserUtil" - +compileJava.options.encoding = 'UTF-8' tasks.withType(JavaCompile) { sourceCompatibility = "1.7"