Android Question [B4X] [B4XPages] Barcode Reader - Arabic read problem

AymanA

Active Member
Licensed User
Hi All,

I am trying to use the same code as on this example, and it works fine for English barcode.

When I try to use it with PDF417 format in Arabic, it returns the char below:

B4X:
Ver_7.0000dEbWKSMb02qLFåÝħ8L7À¼w÷n𺯣ÿQGA
d«Ú®"¼ñHò´.ëÑè?>ãÜ)2eºÈQK¤ÕÁ]¯Ñ¶CFQy¿¦¯Zé¿[Á7gVñ_÷(ÙvJ]v¸lã¬&ôQÖ}¶²îp+âèÔÐuºãÖÎη Ü1ñ1%g"_642q¡h��¥· ÄäÓÈbÌOö×ÌαêBezSàá6¡û'Nâ2Ú½`xQ×XæÒ{«%³~èÆIá&hÞ J?Üü¥èÀMgG]r    Oëô¨L`omã

So I guessed it is because it needs to be UTF8, so I have tried to use the ICUB4A to see if it is UTF8 and it indeed returns UTF-8.

So I tried to use the decodeURL but returned an error:
B4X:
java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern : %g"

So I am not entirely sure how to read PDF417 barcode that contains Arabic characters if someone can help or guide me to the correct direction.

B4X:
Private Sub FoundBarcode (msg As String)
    lblResult.Text = msg
    toast.Show($"Found [Color=Blue][b][plain]${msg}[/plain][/b][/Color]"$)
    Log(msg)
    File.WriteString(File.DirDefaultExternal, "String.txt", _
        msg)
    Dim fileLocation As String
    fileLocation = File.Combine(File.DirDefaultExternal,"String.txt")
    Dim detectionResult As String
    detectionResult =icu.readFileAsStringGuessEncoding(fileLocation)
    Log(detectionResult)
    Dim su As StringUtils
    Log(su.DecodeUrl(msg,"UTF8"))
End Sub
 

AymanA

Active Member
Licensed User
Hi Erel, thank you for your help, I will need to test with another Arabic generated barcode, I was trying to read an id which I think it will be encrypted, sorry very new to barcode! But here is the barcode:
 

Attachments

  • 20190504_205755.jpg
    20190504_205755.jpg
    18.3 KB · Views: 209
Upvote 0
Top