mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-12-28 03:17:51 +01:00
UTF-16 uses non-parity definition for saving
This commit is contained in:
parent
445b47c581
commit
577cbee31a
@ -165,6 +165,16 @@ public class Config extends ConfigSection {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the default charset to use UTF-16
|
||||||
|
*
|
||||||
|
* @return this class
|
||||||
|
*/
|
||||||
|
public Config setUseUTF16() {
|
||||||
|
this.defaultCharset = StandardCharsets.UTF_16;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getAutosave() {
|
public boolean getAutosave() {
|
||||||
return autosave;
|
return autosave;
|
||||||
}
|
}
|
||||||
@ -370,7 +380,7 @@ public class Config extends ConfigSection {
|
|||||||
Charset charset = TextUtils.detectCharset(stream, StandardCharsets.UTF_8);
|
Charset charset = TextUtils.detectCharset(stream, StandardCharsets.UTF_8);
|
||||||
// upgrade charset if file was saved in a more complex format
|
// upgrade charset if file was saved in a more complex format
|
||||||
if(charset == StandardCharsets.UTF_16BE || charset == StandardCharsets.UTF_16LE) {
|
if(charset == StandardCharsets.UTF_16BE || charset == StandardCharsets.UTF_16LE) {
|
||||||
defaultCharset = charset;
|
defaultCharset = StandardCharsets.UTF_16;
|
||||||
}
|
}
|
||||||
this.load(new InputStreamReader(stream, charset));
|
this.load(new InputStreamReader(stream, charset));
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user