QRCode issue creating iCalendar QR code, missing line feeds
Added by scotteh about 5 years ago
I am passing a string that contains URL encoded %0a (line feed) values to create a QR code for an iCalendar entry however when I decode the resulting QR code it does not contain the %0a values. Because of this several QR smart phone apps are detecting an error with the iCal entry and in most cases not displaying all of the data.
Here is the resulting string I get for the decode.
BEGIN:VCALENDARVERSION:2.0BEGIN:VEVENTSUMMARY:TestDESCRIPTION:TestDTSTART:20120103T000500DTEND:20120103T000559END:VEVENTEND:VCALENDAR
The string should look like this when decoded.
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
SUMMARY:Test
DESCRIPTION:Test
DTSTART:20120103T000500
DTEND:20120103T000559
END:VEVENT
END:VCALENDAR
Generic Handler code
public void ProcessRequest (HttpContext context) {
string urlCode = context.Request.QueryString.Get("code");
context.Response.ContentType = "image/png";
if (urlCode.Length > 0) {
MessagingToolkit.QRCode.Codec.QRCodeEncoder qe = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
qe.QRCodeErrorCorrect = MessagingToolkit.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.M;
qe.QRCodeEncodeMode = MessagingToolkit.QRCode.Codec.QRCodeEncoder.ENCODE_MODE.BYTE;
qe.QRCodeVersion = 10;
System.Drawing.Bitmap bm = qe.Encode(urlCode);
bm.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
}
}
Code that retrieves HTTP GET values and call handler
@Code
Dim strCode As String = Request.QueryString("code")
End Code
@Section head
End Section
<div>
<img src="qr.ashx?code=@strCode"/>
</div>
qr6.jpg - QR without line feeds (58.5 kB)
Replies (4)
RE: QRCode issue creating iCalendar QR code, missing line feeds - Added by admin about 5 years ago
Hi,
Can you try with the sample app? I have no problem encoding/decoding a iCal with line feed using the sample app.
Thanks
Regards
admin
RE: QRCode issue creating iCalendar QR code, missing line feeds - Added by scotteh about 5 years ago
Excuse my ignorance but the QRCodeSample.exe app I have will only accept a single line of data. I'm not sure how to add line feeds and if I change the input box to multiline and run the app it throws an error?
RE: QRCode issue creating iCalendar QR code, missing line feeds - Added by admin about 5 years ago
Hi,
We changed the sample code to accept multiple lines, and was able to encode/decode without problem.
What errors you encountered?
Thanks
Regards
admin
RE: QRCode issue creating iCalendar QR code, missing line feeds - Added by admin about 5 years ago
You can also try with the attached files.
MessagingToolkit.QRCode.dll (5.9 MB)
QRCodeSample.exe (20 kB)
(1-4/4)