Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GPX.read cannot handle Files with BOM #190

@kkuenze

Description

@kkuenze

Two files, both UFT8 one with, one without BOM

GPX.read cannot handle the file with BOM. Txt files are GPX files, but GPX Files could not be uploaded here

Sample Code:

@Slf4j
public class GpxApplication {
	public static void main(String[] args) {
        File[] files = new File("/Users/kk/ij_git/gpx/input").listFiles();
        assert files != null;
        for (File file : files) {
            if (file.isFile() && file.getName().endsWith("txt")) {
                try {
                    GPX gpxR = GPX.read(file.toPath());
                    log.info("filen: {} //  gpx: {}", file.getName(), gpxR.toString());
                } catch (IOException e) {
                    log.error("cannot read file: {} {}", file.getName(), e.getLocalizedMessage());
                    e.printStackTrace();
                }
            }
        }
	}
}

Regrads,

Klaus

WithBom.txt
WithoutBom.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions