From bea2058d72192970c02b33539e9648c43b34ba19 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Fri, 31 Mar 2017 08:30:54 +1000 Subject: [PATCH] more attempts at utf8 mapping --- deps/aha/aha.c | 4 ++-- www/header.tpl | 1 + www_msgs.c | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/deps/aha/aha.c b/deps/aha/aha.c index 33ac202..eae163f 100644 --- a/deps/aha/aha.c +++ b/deps/aha/aha.c @@ -337,7 +337,7 @@ char * aha(char *input) append_output(&output, " ", &size, &outat); line=0; momline++; - append_output(&output, "
", &size, &outat); + append_output(&output, "
\n", &size, &outat); } else if (c!=8) { @@ -359,7 +359,7 @@ char * aha(char *input) case '>': append_output(&output, ">", &size, &outat); break; case '\n':case 13: momline++; line=0; - append_output(&output, "
", &size, &outat); + append_output(&output, "
\n", &size, &outat); break; case ' ': append_output(&output, " ", &size, &outat); break; default: { diff --git a/www/header.tpl b/www/header.tpl index e56aedb..29bb8f5 100644 --- a/www/header.tpl +++ b/www/header.tpl @@ -2,6 +2,7 @@ Magicka BBS +
diff --git a/www_msgs.c b/www_msgs.c index 7e21701..7887270 100644 --- a/www_msgs.c +++ b/www_msgs.c @@ -471,7 +471,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i - aha_text = (char *)malloc(jmh.TxtLen + 1); + aha_text = (char *)malloc((jmh.TxtLen + 1) * 2); aha_cp437 = (char *)malloc(jmh.TxtLen + 1); iconv_cp437 = aha_cp437; @@ -481,14 +481,16 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i aha_cp437[jmh.TxtLen] = '\0'; insz = jmh.TxtLen; - outsz = jmh.TxtLen; + outsz = jmh.TxtLen * 2; - ic = iconv_open("UTF-8//TRANSLIT", "CP437"); + memxet(aha_text, 0, (jmh.TxtLen + 1) * 2); + + ic = iconv_open("UTF-8", "CP437"); iconv(ic, &iconv_cp437, &insz, &iconv_text, &outsz); iconv_close(ic); free(aha_cp437); - aha_text[jmh.TxtLen] = '\0'; + aha_out = aha(aha_text); while (len + strlen(aha_out) > max_len - 1) {