[Freeassociation-devel] Problems with un-escaped characters in TZID

Brad Hards bradh at frogmouth.net
Thu Jan 7 02:59:47 PST 2010


On Thursday 07 January 2010 10:23:37 Wilfried Goesgens wrote:
> hm, It seems as if my reply was aten:  
> 
> Brad, I think its patch messing up the utf8 code.  
The utf8 bit is just accidental damage (my editor isn't handling it correctly). Ignore that.

> Could you please move the utf-8 sequences in its own file, and load it
> instead of having it inline?  
I'm not intending any changes to the UTF8 bit. 

The intended part of the patch is this:
 --- src/test/regression.c       (revision 982)
+++ src/test/regression.c       (working copy)
@@ -1255,7 +1255,23 @@
     icalvalue_free(v);
 }
 
+void test_tzid_escape(){
+    icalparameter *tzid;
+    icalproperty *prop;
 
+    tzid = icalparameter_new_tzid("Timezone\nwith a newline");
+    prop = icalproperty_new_dtstart(icaltime_from_day_of_year(26, 2009));
+    icalproperty_add_parameter(prop, tzid);
+
+    if (VERBOSE)
+      printf("%s\n",icalproperty_as_ical_string(prop));
+
+    is("test encoding of 'Timezone\\nwith a newline'",
+       icalproperty_as_ical_string(prop), "DTSTART;VALUE=DATE,TZID=Timezone\\nwith a newline:20090126");
+
+    icalproperty_free(prop);
+}
+
 void test_requeststat()
 {
     icalproperty *p;
@@ -3696,6 +3712,7 @@
     test_run("Test classify ", test_classify, do_test, do_header);
     test_run("Test Iterators", test_iterators, do_test, do_header);
     test_run("Test strings", test_strings, do_test, do_header);
+    test_run("Test TZID escaping", test_tzid_escape, do_test, do_header);
     test_run("Test Compare", test_compare, do_test, do_header);
     test_run("Create Simple Component", create_simple_component, do_test, do_header);
     test_run("Create Components", create_new_component, do_test, do_header);





More information about the libical-devel mailing list