From 6aa2466b525a45a7a7eacc44e1cbcde663879f21 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 11 May 2016 18:50:44 -0400 Subject: More fixes to handel new lines --- ws2a/testhtmlreplace.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ws2a/testhtmlreplace.c') diff --git a/ws2a/testhtmlreplace.c b/ws2a/testhtmlreplace.c index 6ac6f90..925bb6d 100644 --- a/ws2a/testhtmlreplace.c +++ b/ws2a/testhtmlreplace.c @@ -24,12 +24,15 @@ char* replaceHTML(char* str){ int hex; sscanf(str+strp,"%%%x",&hex); //printf("Was:%c\n",(char)hex); - if(hex == 0x0D) continue; + if(hex == 0x0D){ + strp+=3; + continue; + } if(hex == 0x0A){ nstr[nstrp] = '\\'; nstr[nstrp+1] = 'n'; nstrp+=2; - strp++; + strp+=3; continue; } nstr[nstrp] = (char)hex; @@ -85,7 +88,7 @@ int main(){ char teststring[] = "This+is+a+test\nWith\nSome\nNewlines"; char* parsed = replaceHTML(teststring); printf("%s\n",parsed); - char teststring2[] = "This+is+another+test"; + char teststring2[] = "This%0D%0Ais+another%0D%0Atest"; char* parsed2 = replaceHTML(teststring2); printf("%s\n",parsed2); return 0; -- cgit v1.2.3-70-g09d2