mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-22 16:56:16 +00:00
Added switch to output some encoding values.
This commit is contained in:
parent
fa864f37b7
commit
ef89185439
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ data/
|
||||
.idea
|
||||
src/main/main.iml
|
||||
cache4.*
|
||||
src/test/test.iml
|
||||
|
@ -131,6 +131,8 @@ public class CommandLineController {
|
||||
if (CommandLineOptions.val_test != null) {
|
||||
if (CommandLineOptions.val_test == 1) {
|
||||
TestFeatures.test1();
|
||||
} else if (CommandLineOptions.val_test == 2) {
|
||||
TestFeatures.test2(user, client);
|
||||
} else {
|
||||
System.out.println("Unknown test " + CommandLineOptions.val_test);
|
||||
}
|
||||
|
@ -499,6 +499,17 @@ public class Database {
|
||||
} catch (Exception e) { throw new RuntimeException(e); }
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
try {
|
||||
ResultSet rs = stmt.executeQuery("PRAGMA encoding");
|
||||
rs.next();
|
||||
return rs.getString(1);
|
||||
} catch (SQLException e) {
|
||||
logger.debug("SQLException: {}", e);
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LinkedList<Chat> getListOfChatsForExport() {
|
||||
LinkedList<Chat> list = new LinkedList<Chat>();
|
||||
|
@ -1,12 +1,14 @@
|
||||
package de.fabianonline.telegram_backup;
|
||||
|
||||
import com.github.badoualy.telegram.tl.api.*;
|
||||
import com.github.badoualy.telegram.api.TelegramClient;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.Statement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.ResultSet;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
class TestFeatures {
|
||||
public static void test1() {
|
||||
@ -51,4 +53,12 @@ class TestFeatures {
|
||||
System.out.println("Success: " + success);
|
||||
System.out.println("Unsupported constructor: " + unsupported_constructor);
|
||||
}
|
||||
|
||||
public static void test2(UserManager user, TelegramClient client) {
|
||||
// Prints system.encoding and default charset
|
||||
System.out.println("Default Charset: " + Charset.defaultCharset());
|
||||
System.out.println("file.encoding: " + System.getProperty("file.encoding"));
|
||||
Database db = new Database(user, client, false);
|
||||
System.out.println("Database encoding: " + db.getEncoding());
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,6 @@ public class CompareVersionsTest {
|
||||
assertEquals(Utils.compareVersions("1.0.4", "1.0.4"), Utils.VERSIONS_EQUAL);
|
||||
assertEquals(Utils.compareVersions("1.0.4-pre.2", "1.0.4-pre.1"), Utils.VERSIONS_EQUAL);
|
||||
assertEquals(Utils.compareVersions("1.0.4", "1.0.4-abcdef-dirty"), Utils.VERSION_2_NEWER);
|
||||
assertEquals(Utils.compareVersions("1.0.5", "1.0.5-test.1"), Utils.VERSION_2_NEWER);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user