Skip to content
Snippets Groups Projects
Commit 933bb339 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed wrong encoding of settings.json, Fixed export

parent 625b9f46
Branches
Tags
1 merge request!58merge new_database_structure into master
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
......
......@@ -37,4 +37,10 @@ public class Budget
{
return paymentSum;
}
@Override
public String toString()
{
return "Budget [incomeSum=" + incomeSum + ", paymentSum=" + paymentSum + "]";
}
}
\ No newline at end of file
......@@ -2,6 +2,9 @@ package de.deadlocker8.budgetmaster.logic;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Locale;
......@@ -17,14 +20,14 @@ public class Utils
public static Settings loadSettings()
{
String settingsJSON;
Settings settings;
try
{
Gson gson = new Gson();
PathUtils.checkFolder(new File(PathUtils.getOSindependentPath() + bundle.getString("folder")));
settingsJSON = new String(Files.readAllBytes(Paths.get(PathUtils.getOSindependentPath() + bundle.getString("folder") + "/settings.json")));
settings = gson.fromJson(settingsJSON, Settings.class);
Reader reader = Files.newBufferedReader(Paths.get(PathUtils.getOSindependentPath() + bundle.getString("folder") + "/settings.json"), Charset.forName("UTF-8"));
settings = gson.fromJson(reader, Settings.class);
reader.close();
return settings;
}
catch(IOException e)
......@@ -38,6 +41,8 @@ public class Utils
Gson gson = new Gson();
String jsonString = gson.toJson(settings);
Files.write(Paths.get(PathUtils.getOSindependentPath() + bundle.getString("folder") + "/settings.json"), jsonString.getBytes());
Writer writer = Files.newBufferedWriter(Paths.get(PathUtils.getOSindependentPath() + bundle.getString("folder") + "/settings.json"), Charset.forName("UTF-8"));
writer.write(jsonString);
writer.close();
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment