Please excuse me for using the translator.
I'm a beginner in programming.
The decades-old circlemud is being modified. Although it is already localized and can be implemented in VC6.0 without any problems, there is a problem in the entry of Korean names as it moves to VS Community 2019.
The game is so old that most of the community in Korea has disappeared, so I couldn't find help and visited the place. I wish I could speak English well, but...
Entering the Korean language (CP949 or?) will cause the ishanalp() to crash. When I added /J and compiled it, there is no crash in the Korean input, but I cannot recognize the Korean name.
Removing the isalpha() part will allow access to the game, but a crash will occur in the area where the name is printed or stored.
debug assertion failed!
File; isctype.cpp Line: 36
#define ishan(ch) (((ch) & 0xE0) > 0x90)
#define ishanasc(ch) (isascii(ch) || ishan(ch))
#define ishanalp(ch) (isalpha(ch) || ishan(ch))
#define isnhdigit(ch) (!ishan(ch) && isdigit(ch))
#define isnhspace(ch) (!ishan(ch) && isspace(ch))
int _parse_name(char *arg, char *name)
{
int i;
/* skip whitespaces */
for (; isnhspace(*arg); arg++);
for (i = 0; (*name = *arg); arg++, i++, name++)
if (!ishanalp(*arg)) // here debug assertion failed line 36
return 1;
if (!i)
return 1;
return 0;
}
ishanalp(static_cast<unsigned char>(*arg))
should fix it, same change for the call to isnhspace
.
It's little known that the is...
character classification functions don't take char
arguments but instead take an int
argument that must have an unsigned char value or be EOF
. If char
is a signed type (as it typically is) and you have a negative value then the is...
function can fail.
I'd also recommend recoding those macros as inline functions.