@scr2em/capacitor-scanner 6.0.26 → 6.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -838,6 +838,12 @@ public class CapacitorScannerPlugin extends Plugin {
838
838
  echo("Barcode has no rawValue or rawBytes, skipping");
839
839
  }
840
840
  }
841
+
842
+ // Strip UTF-8 BOM if present
843
+ if (rawValue != null && rawValue.startsWith("\uFEFF")) {
844
+ rawValue = rawValue.substring(1);
845
+ }
846
+
841
847
  echo("Processing barcode with rawValue: " + rawValue);
842
848
 
843
849
  // Apply Regex Filter if present
@@ -753,8 +753,12 @@ public class CapacitorScannerPlugin: CAPPlugin, CAPBridgedPlugin, AVCaptureMetad
753
753
 
754
754
  // Then process only that barcode if found
755
755
  if let bestObservation = highestConfidenceBarcode,
756
- let payload = bestObservation.payloadStringValue
756
+ var payload = bestObservation.payloadStringValue
757
757
  {
758
+ // Strip UTF-8 BOM if present
759
+ if payload.hasPrefix("\u{FEFF}") {
760
+ payload = String(payload.dropFirst())
761
+ }
758
762
  // Update the last barcode detection time
759
763
  self.lastBarcodeDetectionTime = Date()
760
764
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scr2em/capacitor-scanner",
3
- "version": "6.0.26",
3
+ "version": "6.0.27",
4
4
  "description": "scan codes",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",