aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Greer <mgreer@animalcreek.com>2016-10-25 09:26:55 -0700
committerSamuel Ortiz <sameo@linux.intel.com>2017-11-10 00:15:10 +0100
commit7afe8460dce3275da71fa2ac8aa338deb373df34 (patch)
tree8a5907adc112d81915f53fb03c029b296d8c80c9
parentb18c489bf8c1c8e087cc97ca7ad8bfaded856e4d (diff)
downloadneard-7afe8460dce3275da71fa2ac8aa338deb373df34.tar.gz
ndef: Add default language ("en") for Text records
Despite section 3.3 of the NFC Forum RTD-Text 1.0 Technical Specification stating in part, "The language code MAY NOT be omitted", some tags have a 0-length language field. A 0-length language field currently causes neard to exit which isn't ideal so choose a default language (generic English) which will be used in these situations. There is no particular reason to choose English other than it is the native language of the patch author and it is the language neard is coded in. Signed-off-by: Mark Greer <mgreer@animalcreek.com> --- This is identical to an earlier patch submitted to the linux-nfc mail list in October (link below) so that patch can be discarded. https://lists.01.org/pipermail/linux-nfc/2016-October/004292.html
-rw-r--r--src/ndef.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ndef.c b/src/ndef.c
index 888ec95..2775bac 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -409,7 +409,10 @@ static const char *get_text_payload(const GDBusPropertyTable *property,
if (!strcmp(property->name, "Encoding"))
return text->encoding;
else if (!strcmp(property->name, "Language"))
- return text->language_code;
+ if (!text->language_code)
+ return "en";
+ else
+ return text->language_code;
else if (!strcmp(property->name, "Representation"))
return text->data;
else