警告多字符字符常量[-Wmultichar]

时间:2014-12-22 14:00:41

标签: c++

我有这个警告多字符字符常量[-Wmultichar]

在我的代码中

    replacement[static_cast<unsigned char>('ľ')] = 'l';
    replacement[static_cast<unsigned char>('š')] = 's';
    replacement[static_cast<unsigned char>('č')] = 'c';
    replacement[static_cast<unsigned char>('ť')] = 't';
    replacement[static_cast<unsigned char>('ž')] = 'z';
    replacement[static_cast<unsigned char>('ý')] = 'y';
    replacement[static_cast<unsigned char>('á')] = 'a';
    replacement[static_cast<unsigned char>('í')] = 'i';
    replacement[static_cast<unsigned char>('é')] = 'e';
    replacement[static_cast<unsigned char>('ô')] = 'o';
    replacement[static_cast<unsigned char>('ú')] = 'u';
    replacement[static_cast<unsigned char>('ň')] = 'n';
    replacement[static_cast<unsigned char>('ů')] = 'u';
    replacement[static_cast<unsigned char>('ř')] = 'r';

请帮帮我

1 个答案:

答案 0 :(得分:0)

尝试至少使用wchar_t并将L放在多字节字符之前:

replacement[L'ľ'] = 'l';

取决于具体情况,但在大多数情况下都会有效。