mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-04-29 03:32:50 -04:00
Force ISO-8859-1 when importing old backups
This will not catch one edge case: use exporting a backup in Catima 2.41.0 - 2.41.2, then uninstall Catima, then installing Catima 2.41.3 and then importing the database. But this seems rare enough to be acceptable.
This commit is contained in:
@@ -459,8 +459,11 @@ public class CatimaImporter implements Importer {
|
||||
barcodeType = CatimaBarcode.fromName(unparsedBarcodeType);
|
||||
}
|
||||
|
||||
// Barcode encoding information is only supported since Catima 2.41.0, so old exports will lack this field
|
||||
// Database migration 19 forcing ISO-8859-1 on all cards, so we should treat imports from old Catima versions the same and force ISO-8859-1 there too
|
||||
// This limits the risk of breaking cards when importing an old database backup
|
||||
Charset barcodeEncoding = null;
|
||||
String unparsedBarcodeEncoding = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.BARCODE_ENCODING, record, "");
|
||||
String unparsedBarcodeEncoding = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.BARCODE_ENCODING, record, "ISO-8859-1");
|
||||
if (!unparsedBarcodeEncoding.isEmpty()) {
|
||||
barcodeEncoding = Charset.forName(unparsedBarcodeEncoding);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user