From 751222824d7c7d5838356536e52a528610c70410 Mon Sep 17 00:00:00 2001 From: Gang Zhuo Date: Thu, 20 Oct 2016 01:03:52 -0400 Subject: [PATCH] input chineses verify code for windows --- shell.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shell.c b/shell.c index 8aaa1f2e..c398f0f6 100644 --- a/shell.c +++ b/shell.c @@ -1199,7 +1199,21 @@ static PcsBool verifycode(unsigned char *ptr, size_t size, char *captcha, size_t fclose(pf); printf("The captcha image at %s.\nPlease input the captcha code: ", savedfile); +#ifdef WIN32 + { + char fmt[32]; + memset(captcha, 0, captchaSize); + snprintf(fmt, sizeof(fmt), "%%%ds", captchaSize - 1); + scanf(fmt, captcha); + } + if (!u8_is_utf8_sys()) { + char *u8s = mbs2utf8(captcha); + strncpy(captcha, u8s, captchaSize); + pcs_free(u8s); + } +#else std_string(captcha, captchaSize); +#endif return PcsTrue; }