Skip to content

Commit f7a8f7f

Browse files
committed
ECI-Flags: Remove Latin1, UTF-8 and ASCII
1 parent c3dd58f commit f7a8f7f

File tree

1 file changed

+7
-3
lines changed
  • libpretixsync/src/main/java/eu/pretix/libpretixsync/utils

1 file changed

+7
-3
lines changed

libpretixsync/src/main/java/eu/pretix/libpretixsync/utils/InputUtils.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ package eu.pretix.libpretixsync.utils
33
fun cleanInput(raw_input: String, source_type: String): String {
44
var cleaned = raw_input.replace(Regex("[\\p{C}]"), "") // remove unprintable characters
55
if (source_type == "barcode") {
6-
// Remove ECI flag for Latin-1 which is prepended by some barcode scanners to QR codes
7-
// generated by the app "WalletPasses" even though it is the default encoding.
6+
// Remove ECI flag which is prepended by some barcode scanners to QR codes generated by the
7+
// app "WalletPasses" (and recently even Google Wallet) even though it is the default encoding.
88
// https://en.wikipedia.org/wiki/Extended_Channel_Interpretation
9-
cleaned = cleaned.removePrefix("\\000001")
9+
cleaned = cleaned
10+
.removePrefix("\\000001") // Latin1
11+
.removePrefix("\\000003") // Latin1
12+
.removePrefix("\\000026") // UTF-8
13+
.removePrefix("\\000027") // ASCII
1014
}
1115
return cleaned
1216
}

0 commit comments

Comments
 (0)