use iconv in www msgs
This commit is contained in:
parent
00703ab5e0
commit
11fe200797
@ -5,6 +5,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/stat.h>
|
||||
#include <iconv.h>
|
||||
#include "bbs.h"
|
||||
#include "jamlib/jam.h"
|
||||
|
||||
@ -554,8 +555,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
}
|
||||
strcat(page, buffer);
|
||||
len += strlen(buffer);
|
||||
|
||||
sprintf(buffer, "<form action=\"%smsgs/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n", conf.www_url);
|
||||
sprintf(buffer, "<form action=\"%smsgs/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded;charset=UTF-8\">\n", conf.www_url);
|
||||
if (len + strlen(buffer) > max_len - 1) {
|
||||
max_len += 4096;
|
||||
page = (char *)realloc(page, max_len);
|
||||
@ -862,7 +862,11 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
struct utsname name;
|
||||
int pos;
|
||||
char *body3;
|
||||
|
||||
iconv_t ic;
|
||||
size_t inc;
|
||||
size_t ouc;
|
||||
size_t sz;
|
||||
char *inbuf, *oubuf;
|
||||
if (conference < 0 || conference >= conf.mail_conference_count || area < 0 || area >= conf.mail_conferences[conference]->mail_area_count) {
|
||||
return 0;
|
||||
}
|
||||
@ -973,6 +977,8 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (conf.mail_conferences[conference]->tagline != NULL) {
|
||||
tagline = conf.mail_conferences[conference]->tagline;
|
||||
} else {
|
||||
@ -1013,13 +1019,26 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
memset(body3, 0, strlen(body2) + 2 + strlen(buffer));
|
||||
pos = 0;
|
||||
sprintf(body3, "%s%s", body2, buffer);
|
||||
|
||||
free(body2);
|
||||
body2 = (char *)malloc(strlen(body3) + 1);
|
||||
|
||||
ic = iconv_open("CP437", "UTF-8");
|
||||
|
||||
if (JAM_AddMessage(jb, &jmh, jsp, (char *)body3, strlen(body3))) {
|
||||
free(body3);
|
||||
free(body2);
|
||||
inc = strlen(body3);
|
||||
ouc = strlen(body3);
|
||||
|
||||
inbuf = body3;
|
||||
oubuf = body2;
|
||||
sz = iconv(ic, &inbuf, &inc, &oubuf, &ouc);
|
||||
free(body3);
|
||||
|
||||
if (JAM_AddMessage(jb, &jmh, jsp, (char *)body2, strlen(body2))) {
|
||||
free(body2);
|
||||
JAM_UnlockMB(jb);
|
||||
JAM_DelSubPacket(jsp);
|
||||
JAM_CloseMB(jb);
|
||||
@ -1034,8 +1053,8 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
free(body2);
|
||||
free(body3);
|
||||
|
||||
JAM_UnlockMB(jb);
|
||||
|
||||
@ -1066,7 +1085,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
|
||||
strcat(page, buffer);
|
||||
len += strlen(buffer);
|
||||
|
||||
sprintf(buffer, "<form action=\"%smsgs/\" method=\"POST\" onsubmit=\"return validate()\" enctype=\"application/x-www-form-urlencoded\">\n", conf.www_url);
|
||||
sprintf(buffer, "<form action=\"%smsgs/\" method=\"POST\" onsubmit=\"return validate()\" enctype=\"application/x-www-form-urlencoded;charset=UTF-8\">\n", conf.www_url);
|
||||
if (len + strlen(buffer) > max_len - 1) {
|
||||
max_len += 4096;
|
||||
page = (char *)realloc(page, max_len);
|
||||
|
Reference in New Issue
Block a user