Skip to content

Error on isdigit, isalpha, isspace with char > 127 #70

Open
@ghost

Description

The is*** functions to check if a char is a digit or space fail if you pass a char that's above 127.

https://en.cppreference.com/w/cpp/string/byte/isalpha

Depending on your compiler you might get an error. You can fix this by casting the value to unsigned char.
Try and match this "Çüéâ" as ASCII.

static int matchdigit(char c)
{
  return isdigit((unsigned char)c);
}
static int matchalpha(char c)
{
  return isalpha((unsigned char)c);
}
static int matchwhitespace(char c)
{
  return isspace((unsigned char)c);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions