more attempts at utf8 mapping

This commit is contained in:
Andrew Pamment 2017-03-31 08:30:54 +10:00
parent 8e2d47c783
commit bea2058d72
3 changed files with 9 additions and 6 deletions

4
deps/aha/aha.c vendored
View File

@ -337,7 +337,7 @@ char * aha(char *input)
append_output(&output, " ", &size, &outat); append_output(&output, " ", &size, &outat);
line=0; line=0;
momline++; momline++;
append_output(&output, "<br />", &size, &outat); append_output(&output, "<br />\n", &size, &outat);
} }
else if (c!=8) else if (c!=8)
{ {
@ -359,7 +359,7 @@ char * aha(char *input)
case '>': append_output(&output, "&gt;", &size, &outat); break; case '>': append_output(&output, "&gt;", &size, &outat); break;
case '\n':case 13: momline++; case '\n':case 13: momline++;
line=0; line=0;
append_output(&output, "<br />", &size, &outat); append_output(&output, "<br />\n", &size, &outat);
break; break;
case ' ': append_output(&output, "&nbsp;", &size, &outat); break; case ' ': append_output(&output, "&nbsp;", &size, &outat); break;
default: { default: {

View File

@ -2,6 +2,7 @@
<HEAD> <HEAD>
<TITLE>Magicka BBS</TITLE> <TITLE>Magicka BBS</TITLE>
<link rel="stylesheet" type="text/css" href="/static/style.css"> <link rel="stylesheet" type="text/css" href="/static/style.css">
<meta charset="utf-8">
</HEAD> </HEAD>
<BODY> <BODY>
<div class="header"> <div class="header">

View File

@ -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); aha_cp437 = (char *)malloc(jmh.TxtLen + 1);
iconv_cp437 = aha_cp437; 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'; aha_cp437[jmh.TxtLen] = '\0';
insz = jmh.TxtLen; 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(ic, &iconv_cp437, &insz, &iconv_text, &outsz);
iconv_close(ic); iconv_close(ic);
free(aha_cp437); free(aha_cp437);
aha_text[jmh.TxtLen] = '\0';
aha_out = aha(aha_text); aha_out = aha(aha_text);
while (len + strlen(aha_out) > max_len - 1) { while (len + strlen(aha_out) > max_len - 1) {