jmporterog / maven-replacer-plugin

Automatically exported from code.google.com/p/maven-replacer-plugin
MIT License
0 stars 0 forks source link

Cannot remove BOM characters #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to remove Byte Order Marks from HTM and CSS files.  When I run mvn 
the files that have the BOM are listed as being replaced by the plugin, and 
their timestamps are updated, but the files are not changed.

    <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>maven-replacer-plugin</artifactId>
        <version>1.3.5</version>
        <executions>
            <execution>
                <phase>clean</phase>
                <goals>
                    <goal>replace</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <encoding>UTF-8</encoding>
            <includes>
                <include>**/*.css</include>
                <include>**/*.htm</include>
            </includes>
            <token>'\xEF\xBB\xBF'</token>
            <regexFlags>
                <regexFlag>CANON_EQ</regexFlag>
                <regexFlag>UNICODE_CASE</regexFlag>
            </regexFlags>
        </configuration>
    </plugin>

Original issue reported on code.google.com by plabee.c...@gmail.com on 12 Jan 2011 at 1:03

GoogleCodeExporter commented 9 years ago
Hi plabee,

I will look into this issue for you.

Thanks,
-- Steven

Original comment by baker.st...@gmail.com on 13 Jan 2011 at 9:29

GoogleCodeExporter commented 9 years ago
Sorry this is taking so long.

Have you tried the ISO-8859-1 representation:   as the token?

-- Steven

Original comment by baker.st...@gmail.com on 24 Jan 2011 at 6:43

GoogleCodeExporter commented 9 years ago
Sorry, I have not received a response in a while. I am going to close this 
Issue.

Original comment by baker.st...@gmail.com on 4 Feb 2011 at 11:26

GoogleCodeExporter commented 9 years ago
You have to try XML-entity  which represents BOM.

Original comment by azakh...@gmail.com on 20 Sep 2012 at 11:46

GoogleCodeExporter commented 9 years ago
Using:  as last comment says worked for me. thanks.

Original comment by sam.mirz...@gmail.com on 22 Dec 2012 at 7:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This is a running example, which works for me:

<plugin>
    <groupId>com.google.code.maven-replacer-plugin</groupId>
    <artifactId>replacer</artifactId>
    <version>1.5.3</version>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>replace</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <encoding>UTF-8</encoding>
        <basedir>${project.basedir}</basedir>
        <includes>
            <include>/src/main/translations/**.properties</include>
        </includes>
        <outputDir>src/main/java/resources</outputDir>
        <preserveDir>false</preserveDir>
        <replacements>
            <replacement>
                <token></token>
                <value></value>
            </replacement>
        </replacements>        
    </configuration>
</plugin>

I had some trouble to find the correct configuration, because the BOM for UTF-8 
should be 'EF BB BF' (hex) and 'FE FF' (hex) should be the BOM for UTF-16 Big 
Endian.
This was really confusing, because I thought the other comments where about a 
UTF-16 BOM

http://en.wikipedia.org/wiki/Byte_Order_Mark#UTF-8

Original comment by ckuetb...@gmail.com on 20 Aug 2014 at 3:51