Skip to content

Commit

Permalink
Remove Charset stuff. Should fix #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
crykn committed Sep 20, 2020
1 parent 1609ecd commit e7ee6f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = "0.2.0"
version = "0.2.2"
ext {
appName = "guacamole"
formicVersion = "0.1.4"
Expand Down
20 changes: 13 additions & 7 deletions gdx/src/main/java/de/damios/guacamole/gdx/assets/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

package de.damios.guacamole.gdx.assets;

import java.nio.charset.Charset;
import java.io.UnsupportedEncodingException;

import com.badlogic.gdx.files.FileHandle;

/**
* A simple asset type for text files. Uses the UTF-8-encoding if supported by
* the local JVM.
* the local JVM; the platform's default encoding otherwise.
*
* @author damios
* @see TextLoader The respective asset loader.
Expand All @@ -30,17 +30,23 @@
*/
public class Text {

private static final Charset CHARSET = Charset.isSupported("UTF-8")
? Charset.forName("UTF-8")
: Charset.defaultCharset();
private static final String CHARSET = "UTF-8"; // Charset.defaultCharset() etc. is not supported on GWT
private String string;

public Text(String string) {
this.string = new String(string.getBytes(), CHARSET);
this(string.getBytes());
}

public Text(FileHandle file) {
this(new String(file.readBytes(), CHARSET));
this(file.readBytes());
}

public Text(byte[] bytes) {
try {
this.string = new String(bytes, CHARSET);
} catch (UnsupportedEncodingException e) {
this.string = new String(bytes);
}
}

/**
Expand Down

0 comments on commit e7ee6f3

Please sign in to comment.