In addition to @moonzai's answer above, I would like to add some details that I could still achieve (using @moonzai post off-course!).
There are still three types of CNIC:
- Regular CNIC [Barcode Encoding: PDF417]
- NICOP Card [Barcode Encoding: Code 128]
- Card with DIP chip [Barcode: QR code]
The last two (2 and 3) have only an ID-card number and some additional numerical details (most likely, the number of problems in case (2) and Nadra_DB_ # in (3))
Here is the information encoded in the PDF417 (1) barcode format:
- Check number (Brocade number), which includes the timestamp of your visit to the NADRAs office.
- CNIC Number
- Family Room (Handan Room)
- Date of Birth
- Full Name [Urdu]
- Fathers Name [Urdu]
- Full address with district and Teshil information [Urdu + English + English-digital]
Urdu is coded, replacing the common part of the HEX code, that is, \ u06 in the case of Java / C / C ++ / ... and "& # x6" in the case of the Web or just 0x06.
eg HEX code for "alif" is \ u0627 or ا they only added 27 and omitted & # x6.
In the case of the word "جاوید", the actual line should look like this: & # x62C & # x627 & # x648 & # x6CC & # x62F
but NADRA only added: 2C2748CC2F (ommitting all & # x6)
Below is the VBA code that helps generate a WEB string for the scanned output of a CNIC card.
I will continue to add refined code, as well as codes in other languages; especially in JS / Jquery and PHP.
Public Function Convert2Urdu (vString As String) As String
Dim vCharArray As Variant, vChar As String
For i = 1 To Len (vString)
vChar = Mid (vString, i, 1)
vCharArray = vCharArray & GetUrduChar (Hex (AscW (vChar)))
Next
Convert2Urdu = vCharArray
End function
Private Function GetUrduChar (vHex) As String
Select Case vHex
'Alphabets
Case "22", "27", "28", "7E", "2A", "79", "2B", "2C", "86", "2D", "2E", "2F", " 88 "," 30 "," 31 "," 91 "," 32 "," 98 "," 33 "," 34 "," 35 "," 36 "," 37 "," 38 "," 39 " , "3A", "41", "42", "A9", "AF", "44", "45", "46", "BA", "48", "C1", "C3", " BE "," 21 "," CC "," D2 "
GetUrduChar = "" & vHex
'Numerics
Case "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F6", "F7", "F8", "F9"
GetUrduChar = "" & vHex
'Eraabs
Case "10", "11", "12", "13", "14", "15", "4B", "4C", "4D", "4E", "4F", "50", " 51 "," 52 "," 53 "," 54 "," 56 "," 57 "," 58 "," 70 "
GetUrduChar = "" & vHex
'Punctuation
Case "1B", "1F", "64", "6C", "D4", "6B"
GetUrduChar = "" & vHex
'Space
Case "20"
GetUrduChar = "" & "0" & vHex
Case else
GetUrduChar = "" & Chr (vHex) & "" 'Ideally, it should be Chr (Asc (Hex)) [working on it]
End select
End function