2

I am facing a problem which I guess little unfamiliar out there (as, searching on google, I found no hint). I am trying to generate QR code using the TCPDF provided class. Almost everything is working fine. I am being able to generate anykind of website link etc.

But when I am trying to generate QR for "Sending Email" and "WiFi Login for android" but they are not getting encoded(or decoded?) properly.

   MATMSG:TO:example@example.com;SUB:Hello;Body:example;;

is getting decoded as

   example@example.com;SUB:Hello;Body:example;;

and

   WIFI:T:WEP;S:affaf;P:aaaa;;

is getting decoded as

  WEP;S:affaf;P:aaaa;;

Further I have noticed that encoding MATMSG is the main problem. I tried this http://blog.qr4.nl/Online-QR-Code_Decoder.aspx to decode QR. They can't decode the QR for MATMSG

But interestingly, QR generated from http://www.qrstuff.com/ for sending email is working perfectly in that decoder. More interestingly, if you just encode the MATMSG using this site's plain text option that doesn't work.

Is there anything tricky for encoding MATMSG ? or could you suggest anything to encode that?

Well, I should mention

   matmsg:TO:example@example.com;SUB:Hello;Body:example;;

   wifi:T:WEP;S:affaf;P:aaaa;;

are getting encoded and decoded nicely. Will those work for sending email and wifi login accordingly? or

   MATMSG:
   TO:example@example.com;SUB:Hello;Body:example;;

   WIFI:
   T:WEP;S:affaf;P:aaaa;;

will these work?

Thanks for your time. Cheers!

Potheek
  • 991
  • 1
  • 8
  • 17

2 Answers2

4

Keep in mind that there are three different formats for encoding a email in a QR:

Mailto (W3C standard)

mailto:email@example.com?subject=email subject&body=Email text

MATMSG (NTT DoCoMo)

MATMSG:TO: email@example.com;SUB:email subject;BODY:Email text;;

SMTP (OMI@)

SMTP:email@example.com:email subject:Email text

Although MATMSG is the most widespread, there are some readers (ie: ScanLife) that doesn't support it

NiloVelez
  • 3,611
  • 1
  • 22
  • 30
1

Your first MATMSG is correct except that "Body" should be "BODY". The WIFI message is correct.

The rest is a function of the particular decoder to support or not. zxing supports these and so I believe (with the correction above) and I believe you are doing it all correctly regarding encoding. You can't fix decoders that don't support it.

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
  • Thanks for your time @Sean. I mistakenly wrote 'Body' here. Zxing is not even getting my bar-codes in my images. The fact you have told about the decoder is really helpful. thanks again. :) – Potheek Aug 16 '12 at 09:46
  • Sounds like there is something wrong with your encoded QR codes then, but you're not being very specific. It reads any valid QR code. – Sean Owen Aug 16 '12 at 10:09
  • Well, that is the confusion I have right now. All I can say the class provided by the TCPDF package is working well with other kind of QRs like url encoding, vcard, vcalendar etc. – Potheek Aug 16 '12 at 11:02
  • Hey, I tried editing my images and then tried the zxing decoder. Guess what? it is working as it supposed to! Can you tell me whether it is necessary to keep a white background behind the QR code or not? – Potheek Aug 16 '12 at 11:16
  • 1
    QR codes need to be dark-on-light and need a minimum light border around it of 4 modules. – Sean Owen Aug 16 '12 at 11:30
  • transparent background was the main problem I guess. Thanks for your valuable time. :) – Potheek Aug 16 '12 at 11:35
  • If you want a transparent background make sure to make it fully-transparent white (ARGB #00FFFFFF), even though the color doesn't matter in theory. The decoder assumes transparent == white already. – Sean Owen Aug 16 '12 at 12:37