字符测试无效

maa*_*lem 6 c encoding character-encoding

当我用'é'执行时,虽然测试被接受!救命!!

#include <stdio.h>
#include <string.h>

int main ()
{
    char  ch[10];
    int i,k,k1;

do
{
    k=0; i=0;   
    printf("Write a sentence without accentuated letters:\n");
    scanf("%s",ch);
    k1=strlen(ch);
    while ((k==0)&&(i<k1))
    {
        if (ch[i]=='é') k=1;
        i++;
    }
}   
while (k==1);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Kar*_*nek 2

问题可能出在编码上。\xc3\xa9根据使用的编码标准可以有不同的数字表示。如果您的源代码编辑器、编译器和命令行使用不同的编码,事情将永远不会以这种方式工作。您可能想切换到 UTF-8。

\n