All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hl7.fhir.utilities.FileFormat Maven / Gradle / Ivy

There is a newer version: 6.4.1
Show newest version
package org.hl7.fhir.utilities;

import java.io.PrintStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class FileFormat {

  public static boolean fileEncodingIsUtf8() {
    return Charset.defaultCharset().equals(StandardCharsets.UTF_8);
  }

  public static void checkCharsetAndWarnIfNotUTF8(PrintStream out) {
    if (fileEncodingIsUtf8()) return;
    out.println("");
    out.println("WARNING: Default file encoding is " + Charset.defaultCharset() + " which may cause unexpected results. ");
    out.println("         To fix this issue, run this program with the parameter '-Dfile.encoding=UTF-8'");
    out.println("         Future releases may not be able to run at all with encoding " + Charset.defaultCharset());
    out.println("");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy