Fixed encoding issue on windows
This commit is contained in:
parent
fa152be94e
commit
d830284ed2
2 changed files with 16 additions and 12 deletions
|
@ -6,7 +6,7 @@ package semantic.model;
|
|||
public interface IModelFunctions
|
||||
{
|
||||
/**
|
||||
* Creates an instance of the class "Lieu" of your ontology
|
||||
* Creates an instance of the class "Place" of your ontology
|
||||
* @param name
|
||||
* @return the URI of the instance
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package semantic.model;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -296,17 +300,17 @@ public class SemanticModel implements IConvenienceInterface
|
|||
void loadFromFile(String path, String base, String lang, boolean supportObjectProperties)
|
||||
{
|
||||
Model tmpModel = ModelFactory.createDefaultModel();
|
||||
FileReader f = null;
|
||||
try
|
||||
{
|
||||
f = new FileReader(new File(path));
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
tmpModel.read(f, base, lang);
|
||||
this.writeFromModel(tmpModel, supportObjectProperties);
|
||||
try (FileInputStream fis = new FileInputStream(path);
|
||||
InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
|
||||
BufferedReader reader = new BufferedReader(isr)
|
||||
) {
|
||||
|
||||
tmpModel.read(reader, base, lang);
|
||||
this.writeFromModel(tmpModel, supportObjectProperties);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue