Uncodin / bypass

Skip the HTML, Bypass takes markdown and renders it directly on Android and iOS.
http://uncodin.github.com/bypass/
Apache License 2.0
1.51k stars 193 forks source link

escape backslash has problem. #156

Open DongHyunKo opened 10 years ago

DongHyunKo commented 10 years ago

this code is not check escape sequence. whenever find backslash, escape_char function skipped 2byte. If you input UTF-8 text with korean or chinese, code will be down.

I think escape_char must check defined escape sequence. i fixed this issues. check it my forked code.

/ orignal code isn't consider UNICODE or general charactor after backslash. so I append to check logic for defined escape sequence.
by DongHyunKo
/ static size_t char_escape(struct buf ob, struct render rndr, char *data, size_t offset, size_t size) { struct buf work = { 0, 0, 0, 0, 0 }; if( data[1] == 'b' || data[1] == 'b' || data[1] == 'f' || data[1] == 'n' || data[1] == 'r' || data[1] == 't' || data[1] == 'v' || data[1] == '\' || data[1] == '\'' || data[1] == '\"' || data[1] == '?' ) { if (size > 1) { if (rndr->make.normal_text) { work.data = data + 1; work.size = 1; rndr->make.normal_text(ob, &work, rndr->make.opaque); } else bufputc(ob, data[1]); } return 2; } return 0; }