Closed rjmangubat23 closed 3 years ago
The e-passport's human-readable personal details content data structure and encoding is via ASN.1/BER TLV; Unicode/UTF-8
. There is no dedicated field in the ICAO spec for RTL/LTR directionality. The determination of directionality
whether a displayable string is right-to-left
or left-to-right
can be deduced via the string content itself.
Since Unicode / UTF-8
is used in the encoding of human-readable contents using national characters, therefore the content string itself can be used for the determination of directionality. Using Java's native support for Unicode:
/**
* Determine if String s is right-to-left or RTL.
* Example of RTL languages: Arabic, Hebrew, etc
*/
private boolean isRTL(String s) {
for (int i = 0; i < s.length(); i++) {
byte d = Character.getDirectionality(s.charAt(i));
if (d == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
d == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC ||
d == Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING ||
d == Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
) {
return true;
}
}
return false;
}
okay thank you closing this issue as current solution is proper workaround.
Current Behaviour
Force app to define if Scanner uses RTL/LTR via
nfcLocale
in ScannerOptionsExpected Behaviour
Find a way if NFC Passport have RTL/LTR embedded locale details