Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
UTF-8 encode user signatures and mark msg headers as UTF-8 encoded
Browse files Browse the repository at this point in the history
When run with a build that includes utf8_encode() (new global JS
function), use it to convert the user's .sig file from CP437 to UTF-8.

When creating a new message (post or email), set the auxattr flag
MSG_HFIELDS_UTF8 since we support UTF-8 chars (not CP437) in message
header fields (e.g. to/from/subject). Requires updated load/smbdefs.js
  • Loading branch information
rswindell committed Aug 26, 2019
1 parent 309062b commit d7ee4e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/lib/forum.js
Expand Up @@ -410,7 +410,10 @@ function getSignature() {
if (!file_exists(fn)) return '';
var f = new File(fn);
f.open('r');
var signature = ascii_str(f.read());
if(js.global.utf8_encode)
var signature = utf8_encode(f.read());
else
var signature = ascii_str(f.read());
f.close();
return signature;
}
Expand Down Expand Up @@ -440,6 +443,7 @@ function postMessage(sub, header, body) {
var msgBase = new MsgBase(sub);
if(msgBase.open()) {
header.ftn_charset = "UTF-8 4";
header.auxattr = MSG_HFIELDS_UTF8;
ret = msgBase.save_msg(header, word_wrap(body));
msgBase.close();
}
Expand Down Expand Up @@ -476,6 +480,7 @@ function postMail(header, body) {
var msgBase = new MsgBase('mail');
if (msgBase.open()) {
header.ftn_charset = "UTF-8 4";
header.auxattr = MSG_HFIELDS_UTF8;
ret = msgBase.save_msg(header, lfexpand(body));
msgBase.close();
}
Expand Down

0 comments on commit d7ee4e4

Please sign in to comment.