Skip to content

Encoding issues with Eclipse WTP HTML format special chars #545

Closed
@source-knights

Description

@source-knights

Hi, I am using the maven spotless version 1.28.0 and Eclipe WTP 4.13.0 (but tried previous versions as well). I'm on windows 10. Tried 3 different developer machines, all showing same issue.

Whenever I use Eclipse WTP / Spotless to format HTML 5 files, the german special chars as in üöäÜÖÄß and the Euro sign € are changed to "üöäÜÖÄ߀". I understand that is actually the binary encoding of these chars if you would wrongly look at the file with non UTF-8 encoding. But as I use UTF-8 in all editors and in the HTML itself and in the spotless config, I don't understand why the files are changed to that by the formatter.

I managed to reprocude this in a simple maven project with only below pom.xml and the pasted HTML file.

Sample HTML5 file (which I save as UTF-8 in IDE, Eclipse, IntelliJ or even Notepad++ all leading to same problem).

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>üöäÜÖÄ߀</title>
</head>
<body>
Test
</body>
</html>

My pom

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sourceknights.test</groupId>
  <artifactId>spotlesstest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>spotlesstest</name>
  
  <build>
    <plugins>
		  <plugin>
			  <groupId>com.diffplug.spotless</groupId>
			  <artifactId>spotless-maven-plugin</artifactId>
			  <version>1.28.0</version>
			  <configuration>
			  
			   <encoding>UTF-8</encoding>
			    
			    <formats>

				    <format>

             <encoding>UTF-8</encoding>

				      <includes>
				        <include>src/**/*.html</include>
				      </includes>
				
				      <eclipseWtp>
				        <!-- Specify the WTP formatter type (XML, JS, ...) -->
				        <type>HTML</type>
				        <!-- Optional, available versions: https://github.com/diffplug/spotless/tree/master/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_wtp_formatters -->
				        <version>4.13.0</version>
				      </eclipseWtp>
				    </format>
				  </formats>
			  </configuration>
		  </plugin>
    </plugins>
  </build>
</project>

Does anyone has an idea what I am doing wrong? All these specials chars are proper UTF-8 chars and allowed in HTML5, so they should not be changed.

Thxalot and stay healthy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions