More Chinese characters support
This commit is contained in:
parent
a1d01ff815
commit
f9e170dd72
@ -19,6 +19,13 @@ v0.71.2 16-Jan-2005
|
||||
that host aka's (node /0) were not presented to the remote.
|
||||
(thanks Przemyslaw Kwiatkowski).
|
||||
|
||||
mbsebbs:
|
||||
When a message is posted by a user, the CHRS kludge of the user
|
||||
is used in the message, not the area setting.
|
||||
When a user logs in, the users locale (guessed value from his
|
||||
characterset) is set. Experimental to see if libc functions will
|
||||
support Chinese characters.
|
||||
|
||||
mbfido:
|
||||
Empty *.msg netmails for our own system are dropped with and
|
||||
logged (just like received empty netmails). Empty netmails to
|
||||
|
@ -127,6 +127,38 @@ char *getchrs(int val)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Experimental table that should translate from the user selected
|
||||
* charset to a locale. This is not the right way to do, the best
|
||||
* thing is to store each bbs users locale instead and then lookup
|
||||
* his characterset using standard library calls.
|
||||
*
|
||||
* This is one of the things the bbs world never saw coming, in the
|
||||
* "good" old days bbses were almost allways called local. Thanks
|
||||
* to the internet bbs users are now all over the world.
|
||||
*/
|
||||
char *getlocale(int val)
|
||||
{
|
||||
switch (val) {
|
||||
case FTNC_NONE: return (char *)"C";
|
||||
case FTNC_CP437: return (char *)"en_US";
|
||||
case FTNC_CP850: return (char *)"en_US";
|
||||
case FTNC_CP865: return (char *)"sv_SE";
|
||||
case FTNC_CP866: return (char *)"ru_RU";
|
||||
case FTNC_CP852: return (char *)"cs_CZ";
|
||||
case FTNC_CP895: return (char *)"cs_CZ";
|
||||
case FTNC_LATIN_1: return (char *)"en_US";
|
||||
case FTNC_LATIN_2: return (char *)"cs_CZ";
|
||||
case FTNC_MAC: return (char *)"en_US";
|
||||
case FTNC_KOI8_R: return (char *)"ru_RU.koi8r";
|
||||
case FTNC_CP936: return (char *)"zh_CN.gbk";
|
||||
default: return (char *)"C";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *getchrsdesc(int val)
|
||||
{
|
||||
switch (val) {
|
||||
|
@ -93,6 +93,8 @@
|
||||
#if !defined(__ppc__)
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
/* used to use #elif, but native braindead hpux 9.00 c compiler didn't
|
||||
* * understand it */
|
||||
@ -2538,6 +2540,7 @@ typedef struct st_charset_table {
|
||||
|
||||
|
||||
char *getchrs(int); /* Return characterset name */
|
||||
char *getlocale(int); /* Return locale name */
|
||||
char *getchrsdesc(int); /* Return characterset description */
|
||||
CharsetTable *charset_table_new(void); /* Add table to linked list */
|
||||
CharsetAlias *charset_alias_new(void); /* Add alias to linked list */
|
||||
|
@ -1052,6 +1052,8 @@ void Chg_Charset()
|
||||
exitinfo.Charset = i;
|
||||
Syslog('+', "New character set %s", getchrs(exitinfo.Charset));
|
||||
WriteExitinfo();
|
||||
setlocale(LC_CTYPE, getlocale(exitinfo.Charset));
|
||||
Syslog('b', "setlocale(LC_CTYPE, NULL) returns \"%s\"", printable(setlocale(LC_CTYPE, NULL), 0));
|
||||
Enter(2);
|
||||
colour(LIGHTGREEN, BLACK);
|
||||
/* Character set now set to: */
|
||||
|
@ -46,8 +46,6 @@
|
||||
#include "ttyio.h"
|
||||
#include "openport.h"
|
||||
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
|
||||
extern int do_quiet; /* Logging quiet flag */
|
||||
@ -228,7 +226,7 @@ int main(int argc, char **argv)
|
||||
/*
|
||||
* Some debugging for me
|
||||
*/
|
||||
Syslog('b', "setlocale() returns \"%s\"", printable(setlocale(LC_ALL, NULL), 0));
|
||||
Syslog('b', "setlocale(LC_ALL, NULL) returns \"%s\"", printable(setlocale(LC_ALL, NULL), 0));
|
||||
/* Next is not usefull */
|
||||
Syslog('b', "nl_langinfo(LC_CTYPE) returns \"%s\"", printable(nl_langinfo(LC_CTYPE), 0));
|
||||
|
||||
|
@ -219,7 +219,12 @@ void Add_Headkludges(faddr *dest, int IsReply)
|
||||
break;
|
||||
}
|
||||
|
||||
if (msgs.Charset != FTNC_NONE) {
|
||||
/*
|
||||
* Set the right charset kludge
|
||||
*/
|
||||
if (exitinfo.Charset != FTNC_NONE) {
|
||||
sprintf(temp, "\001CHRS: %s", getchrs(exitinfo.Charset));
|
||||
} else if (msgs.Charset != FTNC_NONE) {
|
||||
sprintf(temp, "\001CHRS: %s", getchrs(msgs.Charset));
|
||||
} else {
|
||||
sprintf(temp, "\001CHRS: %s", getchrs(FTNC_LATIN_1));
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "ttyio.h"
|
||||
|
||||
|
||||
|
||||
extern int sock;
|
||||
extern pid_t mypid;
|
||||
char *StartTime = NULL;
|
||||
@ -463,6 +464,9 @@ void user()
|
||||
Chg_Charset();
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, getlocale(exitinfo.Charset));
|
||||
Syslog('b', "setlocale(LC_CTYPE, NULL) returns \"%s\"", printable(setlocale(LC_CTYPE, NULL), 0));
|
||||
|
||||
GetLastUser();
|
||||
StartTime = xstrcpy(GetLocalHM());
|
||||
ChangeHomeDir(exitinfo.Name, exitinfo.Email);
|
||||
|
Reference in New Issue
Block a user