Skip to content
Snippets Groups Projects
Commit be066adf authored by rswindell's avatar rswindell
Browse files

When the created message is UTF-8, translate (from CP-437 to UTF-8) any

user signature (.sig file) or editor created message tag (editor.tag file)
contents before adding to message base.
parent 4b414901
No related branches found
No related tags found
No related merge requests found
......@@ -515,7 +515,6 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
bputs(text[OutOfBytes]);
}
else if(useron_xedit) {
if(editor!=NULL)
......@@ -640,8 +639,9 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
return(false);
}
l=process_edited_text(buf,stream,mode,&lines,cfg.level_linespermsg[useron_level]);
bool utf8 = !str_is_ascii(buf) && utf8_str_is_valid(buf);
if(charset != NULL) {
if(!str_is_ascii(buf) && utf8_str_is_valid(buf))
if(utf8)
*charset = FIDO_CHARSET_UTF8;
}
......@@ -656,7 +656,12 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
if(!fgets(str,sizeof(str),sig))
break;
truncsp(str);
l+=fprintf(stream,"%s\r\n",str);
if(utf8) {
char buf[sizeof(str)*4];
cp437_to_utf8_str(str, buf, sizeof(buf) - 1, /* minval: */'\x02');
l+=fprintf(stream,"%s\r\n", buf);
} else
l+=fprintf(stream,"%s\r\n",str);
lines++; /* line counter */
}
fclose(sig);
......@@ -670,7 +675,12 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
if(!fgets(str,sizeof(str),tag))
break;
truncsp(str);
l+=fprintf(stream,"%s\r\n",str);
if(utf8) {
char buf[sizeof(str)*4];
cp437_to_utf8_str(str, buf, sizeof(buf) - 1, /* minval: */'\x02');
l+=fprintf(stream,"%s\r\n", buf);
} else
l+=fprintf(stream,"%s\r\n",str);
lines++; /* line counter */
}
fclose(tag);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment